#include <bits/stdc++.h>
using namespace std;
const long long int mxsize = 1e5 + 15;
const long long int linf = 1e16;
const long long int mod = 1e9 + 7;
long long int pow(long long int x, long long int n) {
  if (n == 0) return 1ll;
  long long int temp;
  temp = pow(x, n / 2);
  if (n % 2 == 0)
    return temp * temp;
  else
    return x * temp * temp;
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int sum_digit(int val) {
  if (val < 0) return -1;
  if (val == 0) return 0;
  int ans = 0;
  while (val > 0) {
    ans = ans + val % 10;
    val = val / 10;
  }
  return ans;
}
long long int count_div(long long int l, long long int r, long long int val) {
  if (l % val == 0)
    return (((r / val) - (l / val)) + 1);
  else
    return ((r / val) - (l / val));
}
int powmod(int x, int y, int m) {
  int res = 1;
  while (y > 0) {
    if (y & 1) res = (res * x) % m;
    cout << res << endl;
    y = y / 2;
    cout << x << endl;
    x = (x * x) % m;
  }
  return res;
}
int main() {
  int n, m;
  cin >> n >> m;
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  queue<int> q;
  int ans = -1;
  for (int i = 0; i < n; i++) q.push(i + 1);
  while (!q.empty()) {
    int curr = q.front();
    q.pop();
    arr[curr - 1] = arr[curr - 1] - m;
    ans = curr;
    if (arr[curr - 1] > 0) q.push(curr);
  }
  cout << ans << endl;
}
