#include <bits/stdc++.h>
using namespace std;
int dp[100001];
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n = 0, q = 0, tm = 0, tm1 = 0, res = 0, indx = 0, rem = -1, max = 0;
  cin >> n >> q;
  int els[n];
  for (int i = (0); i < (n); i++) {
    cin >> tm;
    els[i] = tm;
    if (tm >= max) {
      max = tm;
      indx = i;
    }
  }
  tm = max / q;
  if (max % q == 0) {
    for (int i = n - 1; i > indx; i--) {
      if (els[i] / q == tm - 1 && els[i] % q > 0) {
        indx = i;
        break;
      }
    }
  } else {
    for (int i = n - 1; i > indx; i--) {
      if (els[i] / q == tm && els[i] % q > 0) {
        indx = i;
        break;
      }
    }
  }
  indx++;
  cout << indx;
  return 0;
}
