#include <bits/stdc++.h>
int main() {
  int n, m, max = 0, maxi = -1, t;
  scanf("%d%d", &n, &m);
  int a[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (a[i] > max) {
      max = a[i];
    }
  }
  if (max % m == 0) {
    for (int i = 0; i < n; i++) {
      a[i] -= ((max / m) - 1) * m;
      if (a[i] > 0 && i > maxi) {
        t = i;
      }
    }
  }
  maxi = 0 - 1;
  if (max % m != 0) {
    for (int i = 0; i < n; i++) {
      a[i] -= max / m * m;
      if (a[i] > 0 && i > maxi) {
        t = i;
      }
    }
  }
  printf("%d", t + 1);
}
