You have an array of positive integers a[1], a[2], ..., a[n] and a set of bad prime numbers b1, b2, ..., bm. The prime numbers that do not occur in the set b are considered good. The beauty of array a is the sum <image>, where function f(s) is determined as follows:

  * f(1) = 0; 
  * Let's assume that p is the minimum prime divisor of s. If p is a good prime, then <image>, otherwise <image>. 



You are allowed to perform an arbitrary (probably zero) number of operations to improve array a. The operation of improvement is the following sequence of actions:

  * Choose some number r (1 ≤ r ≤ n) and calculate the value g = GCD(a[1], a[2], ..., a[r]). 
  * Apply the assignments: <image>, <image>, ..., <image>. 



What is the maximum beauty of the array you can get? 

Input

The first line contains two integers n and m (1 ≤ n, m ≤ 5000) showing how many numbers are in the array and how many bad prime numbers there are.

The second line contains n space-separated integers a[1], a[2], ..., a[n] (1 ≤ a[i] ≤ 109) — array a. The third line contains m space-separated integers b1, b2, ..., bm (2 ≤ b1 < b2 < ... < bm ≤ 109) — the set of bad prime numbers.

Output

Print a single integer — the answer to the problem.

Examples

Input

5 2
4 20 34 10 10
2 5


Output

-2


Input

4 5
2 4 8 16
3 5 7 11 17


Output

10

Note

Note that the answer to the problem can be negative.

The GCD(x1, x2, ..., xk) is the maximum positive integer that divides each xi.

import java.io.*;
import java.util.*;

public class B {
	FastScanner in = new FastScanner(System.in);
	PrintWriter out = new PrintWriter(System.out);

	boolean[] primeList;
	
	boolean isPrime(int n) {
		if (n < 0) return false;
		return primeList[n];
	}
	
	boolean[] getPrimeList(int n) {
		boolean[] res = new boolean[n+1];
		
		Arrays.fill(res, true);

		res[0] = res[1] = false;
		for (int i = 2; i < res.length; i++) {
			if (!res[i]) continue;
			for (int j = 2 * i; j < res.length; j += i) {
				res[j] = false;
			}
		}
		
		return res;
	}
	
	long gcd(long x, long y) {
		if (x == 0 || y == 0) return x + y;
		return gcd(y, x % y);
	}
	
	public void run() {
		int n = in.nextInt();
		int m = in.nextInt();
		
		primeList = getPrimeList(100000);
		int[] prime = new int[50000];
		int size = 0;
		for (int i = 0; i < primeList.length; i++) {
			if (primeList[i]) {
				prime[size++] = i;
			}
		}
		prime = Arrays.copyOf(prime, size);

		int[] a = in.nextIntArray(n);
		int[] b = in.nextIntArray(m);
		HashSet<Integer> badPrime = new HashSet<Integer>();
		boolean[] smallBadPrime = new boolean[32000];
		for (int p : b) {
			badPrime.add(p);
			if (p < 32000)
				smallBadPrime[p] = true;
		}
		
		int[] g = new int[n];
		g[0] = a[0];
		for (int i = 1; i < n; i++) {
			g[i] = (int)gcd(g[i-1], a[i]);
		}

		int rem = 1;
		for (int i = n - 1; i >= 0; i--) {
			int tmp = g[i] / rem;
			int cnt = 0;
			for (int j = 0; prime[j] * prime[j] <= tmp; j++) {
				while (tmp % prime[j] == 0) {
					tmp /= prime[j];
					if (smallBadPrime[prime[j]]) cnt--;
					else cnt++;
				}
			}
			if (tmp != 1) {
				if (badPrime.contains(tmp)) cnt--;
				else cnt++;
			}
			if (cnt <= 0) {
				rem = g[i];
			}
			a[i] /= rem;
		}
		
		long res = 0;
		for (int i = 0; i < n; i++) {
			for (int j = 0; prime[j] * prime[j] <= a[i]; j++) {
				while (a[i] % prime[j] == 0) {
					a[i] /= prime[j];
					if (smallBadPrime[prime[j]]) res--;
					else res++;
				}
			}
			if (a[i] != 1) {
				if (badPrime.contains(a[i])) res--;
				else res++;
			}
		}
		System.out.println(res);
		out.close();
	}

	public static void main(String[] args) {
		new B().run();
	}

	public void mapDebug(int[][] a) {
		System.out.println("--------map display---------");

		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < a[i].length; j++) {
				System.out.printf("%3d ", a[i][j]);
			}
			System.out.println();
		}

		System.out.println("----------------------------");
		System.out.println();
	}

	public void debug(Object... obj) {
		System.out.println(Arrays.deepToString(obj));
	}

	class FastScanner {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public FastScanner(InputStream stream) {
			this.stream = stream;
			//stream = new FileInputStream(new File("dec.in"));

		}

		int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		boolean isEndline(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		int[] nextIntArray(int n) {
			int[] array = new int[n];
			for (int i = 0; i < n; i++)
				array[i] = nextInt();

			return array;
		}

		int[][] nextIntMap(int n, int m) {
			int[][] map = new int[n][m];
			for (int i = 0; i < n; i++) {
				map[i] = in.nextIntArray(m);
			}
			return map;
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		long[] nextLongArray(int n) {
			long[] array = new long[n];
			for (int i = 0; i < n; i++)
				array[i] = nextLong();

			return array;
		}

		long[][] nextLongMap(int n, int m) {
			long[][] map = new long[n][m];
			for (int i = 0; i < n; i++) {
				map[i] = in.nextLongArray(m);
			}
			return map;
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		double[] nextDoubleArray(int n) {
			double[] array = new double[n];
			for (int i = 0; i < n; i++)
				array[i] = nextDouble();

			return array;
		}

		double[][] nextDoubleMap(int n, int m) {
			double[][] map = new double[n][m];
			for (int i = 0; i < n; i++) {
				map[i] = in.nextDoubleArray(m);
			}
			return map;
		}

		String next() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		String[] nextStringArray(int n) {
			String[] array = new String[n];
			for (int i = 0; i < n; i++)
				array[i] = next();

			return array;
		}

		String nextLine() {
			int c = read();
			while (isEndline(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndline(c));
			return res.toString();
		}
	}
}

