source_code: import java.io.InputStreamReader;
  import java.io.IOException;
  import java.util.Arrays;
  import java.io.BufferedReader;
  import java.io.OutputStream;
  import java.io.PrintWriter;
  import java.util.StringTokenizer;
  import java.io.InputStream;
  
  /**
   * Built using CHelper plug-in
   * Actual solution is at the top
   */
  public class Main {
  	public static void main(String[] args) {
  		InputStream inputStream = System.in;
  		OutputStream outputStream = System.out;
  		InputReader in = new InputReader(inputStream);
  		PrintWriter out = new PrintWriter(outputStream);
  		TaskA solver = new TaskA();
  		solver.solve(1, in, out);
  		out.close();
  	}
  }
  
  class TaskA {
      public void solve(int testNumber, InputReader in, PrintWriter out) {
          int n = in.nextInt();
          long k = in.nextLong();
          long[] a = new long[n];
          for (int i = 0; i < n; ++i) a[i] = in.nextLong();
          Arrays.sort(a);
          boolean[] take = new boolean[n];
          Arrays.fill(take, true);
          int j = 0;
          int res = n;
          for (int i = 0; i < n; ++i) {
              while (j < i && a[j] * k < a[i]) ++j;
              if (j < i && take[j] && a[j] * k == a[i]) {
                  take[i] = false;
                  --res;
              }
          }
          out.println(res);
      }
  }
  
  class InputReader {
      public BufferedReader reader;
      public StringTokenizer tokenizer;
  
      public InputReader(InputStream stream) {
          reader = new BufferedReader(new InputStreamReader(stream));
          tokenizer = null;
      }
  
      public String next() {
          while (tokenizer == null || !tokenizer.hasMoreTokens()) {
              try {
                  tokenizer = new StringTokenizer(reader.readLine());
              } catch (IOException e) {
                  throw new RuntimeException(e);
              }
          }
          return tokenizer.nextToken();
      }
  
      public int nextInt() {
          return Integer.parseInt(next());
      }
  
      public long nextLong() {
          return Long.parseLong(next());
      }
  
      }
  
  