#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int m, n, i, j, ara[111], maax, div, mid, ans;
  cin >> n >> m;
  for (i = 1; i <= n; i++) cin >> ara[i];
  maax = ara[1];
  for (i = 2; i <= n; i++) {
    if (ara[i] >= maax) maax = ara[i];
  }
  div = maax / m;
  if (maax % m == 0)
    mid = (div - 1) * m;
  else
    mid = div * m;
  for (i = 1; i <= n; i++) ara[i] -= mid;
  j = 0;
  for (i = 1; i <= n; i++) {
    if (ara[i] >= 0 && ara[i] != 0) {
      ans = i;
      j = ara[i];
    }
  }
  cout << ans << endl;
  return 0;
}
