There are n children in Jzzhu's school. Jzzhu is going to give some candies to them. Let's number all the children from 1 to n. The i-th child wants to get at least ai candies.Jzzhu asks children to line up. Initially, the i-th child stands at the i-th place of the line. Then Jzzhu start distribution of the candies. He follows the algorithm:  Give m candies to the first child of the line.  If this child still haven't got enough candies, then the child goes to the end of the line, else the child go home.  Repeat the first two steps while the line is not empty. Consider all the children in the order they go home. Jzzhu wants to know, which child will be the last in this order?

The first line contains two integers n, m (1 ≤ n ≤ 100; 1 ≤ m ≤ 100). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 100).

Output a single integer, representing the number of the last child.

NoteLet's consider the first sample. Firstly child 1 gets 2 candies and go home. Then child 2 gets 2 candies and go to the end of the line. Currently the line looks like [3, 4, 5, 2] (indices of the children in order of the line). Then child 3 gets 2 candies and go home, and then child 4 gets 2 candies and goes to the end of the line. Currently the line looks like [5, 2, 4]. Then child 5 gets 2 candies and goes home. Then child 2 gets two candies and goes home, and finally child 4 gets 2 candies and goes home.Child 4 is the last one who goes home.

using System;
using System.Linq;
namespace codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] x = Console.ReadLine().Split().Select(z => int.Parse(z)).ToArray();
            int[] a = Console.ReadLine().Split().Select(z => (int)Math.Ceiling(double.Parse(z)/x[1])).ToArray();
            int rez = Array.LastIndexOf(a,a.Max())+1;
            Console.WriteLine(rez);
        }
    }
}

using System;
using System.Linq;

namespace CSharp
{
    public class _450A
    {
        public static void Main(string[] args)
        {
            string[] tokens = Console.ReadLine().Split();

            int n = int.Parse(tokens[0]);
            int m = int.Parse(tokens[1]);

            int last = Console
                .ReadLine()
                .Split()
                .Select((token, i) => new
                {
                    Count = (int.Parse(token) + m - 1) / m,
                    Index = i + 1
                })
                .OrderByDescending(x => x.Count)
                .ThenByDescending(x => x.Index)
                .First()
                .Index;

            Console.WriteLine(last);
        }
    }
}

using System;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Diagnostics;
using Enu = System.Linq.Enumerable;

class Program
{
    void Solve()
    {
        int N = reader.Int(), M = reader.Int();
        int maxNeed = -1;
        int who = -1;

        for (int i = 0; i < N; i++)
        {
            int x = reader.Int();
            int need = (x + M - 1) / M;
            if (need >= maxNeed)
            {
                maxNeed = need;
                who = i;
            }
        }

        Console.WriteLine(who + 1);
        Console.ReadLine();
    }

    static void Main() { new Program().Solve(); }
    Reader reader = new Reader(Console.In);

    class Reader
    {
        private readonly TextReader reader;
        private readonly char[] separator = new char[] { ' ' };
        private readonly StringSplitOptions removeOp = StringSplitOptions.RemoveEmptyEntries;
        private string[] A = new string[0];
        private int i;

        public Reader(TextReader r) { reader = r; }
        public bool HasNext() { return Enqueue(); }
        public string String() { return Dequeue(); }
        public int Int() { return int.Parse(Dequeue()); }
        public long Long() { return long.Parse(Dequeue()); }
        public double Double() { return double.Parse(Dequeue()); }
        public int[] IntLine() { var s = Line(); return s == "" ? new int[0] : Array.ConvertAll(Split(s), int.Parse); }
        public int[] IntArray(int N) { return Enumerable.Range(0, N).Select(i => Int()).ToArray(); }
        public int[][] IntGrid(int H) { return Enumerable.Range(0, H).Select(i => IntLine()).ToArray(); }
        public string[] StringArray(int N) { return Enumerable.Range(0, N).Select(i => Line()).ToArray(); }
        public string Line() { return reader.ReadLine().Trim(); }
        private string[] Split(string s) { return s.Split(separator, removeOp); }
        private bool Enqueue()
        {
            if (i < A.Length) return true;
            string line = reader.ReadLine();
            if (line == null) return false;
            if (line == "") return Enqueue();
            A = Split(line);
            i = 0;
            return true;
        }
        private string Dequeue() { Enqueue(); return A[i++]; }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split();
            int n=int.Parse(input[0]), m=int.Parse(input[1]),i;
            bool last;
            input = Console.ReadLine().Split();
            int[] arr=new int[input.Length];
            for (i = 0; i < input.Length; i++)
            {
                arr[i] = int.Parse(input[i]);
            }
            i = 0;
            while (true)
            {
                if (arr[i] <= m)
                {
                    last = true;
                    arr[i] = -1;
                    for (int ii = 0; ii < n; ii++)
                    {
                        if (arr[ii] != -1)
                        {
                            last = false;
                            break;
                        }
                    }
                    if (last == true)
                    {
                        Console.Write(i+1);
                        break;
                    }
                }
                else
                {
                    arr[i] -= m;
                }
                i++;
                if (i == n) { i = 0; }
            }
        }
    }
}

using System;
using System.Linq;

namespace Contest
{
    internal class Program
    {
        private static void Main()
        {
            var p = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();
            var val = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();
            var index = 0;
            while (true)
            {
                var zero = 0;
                for (var i = 0; i < val.Length; i++)
                {
                    if (val[i] > 0)
                    {
                        val[i] -= p[1];
                        if (val[i] <= 0) index = i;
                    }
                    else
                    {
                        zero++;
                    }
                }
                if (zero == val.Length) {Console.WriteLine(index+1); return; }
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            string firstLine = Console.ReadLine();
            string secondLine = Console.ReadLine();

            string[] boys = firstLine.Split(new char[] { ' ' });
            int countBoys = int.Parse(boys[0]);
            int giveAmount = int.Parse(boys[1]);

            string[] boyWants = secondLine.Split(new char[] { ' ' });
            int max = 0;
            Queue<int> orders = new Queue<int>();
            int i = 0;
            while (orders.Count() < countBoys)
            {
                int remain = int.Parse(boyWants[i]) - giveAmount;
                boyWants[i] = remain.ToString();
                if (remain <= 0 && !orders.Contains(i))
                    orders.Enqueue(i);
                i++;
                if (i == countBoys) i = 0;
            }
            var last = orders.Last();
            Console.WriteLine(last + 1);

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {

            string[]r = Console.ReadLine().Split(' ');
            int n = int.Parse(r[0]);
            int m = int.Parse(r[1]);

            String[] h = Console.ReadLine().Split(' ');
            int[] child = Array.ConvertAll(h, int.Parse);
            bool f = true;
            int index = n;
            while(f)
            {
                f = false;

                for (int i = 0; i < child.Length; i++)
                {
                    if (child[i] > 0)
                    {
                        if (child[i] > m)
                        {
                            child[i] -= m;
                            index = i + 1;
                            f = true;
                        }
                        else
                            child[i] = 0;
                    }
                }
            }
            Console.WriteLine(index);
            //Console.ReadKey();
        }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Jzzhu_and_Children
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int n = Int32.Parse(s[0]);
            int m = Int32.Parse(s[1]);
            int ans = 0, index = 0;
            int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);
            for (int i = 0; i < n; i++)
            {
                int count = 0;
                while (a[i] > 0)
                {
                    a[i] -= m;
                    count++;
                }
                if (count >= ans)
                {
                    index = i;
                    ans = count;
                }
            }
            Console.WriteLine(index + 1);
            Console.ReadLine();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int n = int.Parse(str[0]), m = int.Parse(str[1]);

            str = Console.ReadLine().Split();
            List<int> mass = new List<int>();
            for (int i = 0; i < n; i++) mass.Add(int.Parse(str[i]));

            List<int> mass1 = new List<int>();
            for (int i = 0; i < n; i++) mass1.Add(i + 1);

            while (mass1.Count != 1)
            {
                mass[0] -= m;
                if (mass[0] > 0)
                {
                    int a = mass[0];
                    mass.RemoveAt(0);
                    mass.Add(a);

                    a = mass1[0];
                    mass1.RemoveAt(0);
                    mass1.Add(a);
                }
                else
                {
                    mass.RemoveAt(0);
                    mass1.RemoveAt(0);
                }
            }
            Console.WriteLine(mass1[0]);
        }
    }
}

using System;
using System.Collections;
using System.Collections.Generic;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		var d=ria();
		int[] A=ria();

		int cnt=0;
		int idx=0;
		int ans=-1;
		while(true){
			if(A[idx]>0){
				A[idx]-=d[1];
				if(A[idx]<=0)cnt++;
				if(cnt==A.Length){
					ans=idx+1;
					break;
				}
			}
			idx++;
			if(idx==A.Length)idx=0;
		}
		Console.WriteLine(ans);

	}

	public Sol(){
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(){return Console.ReadLine().Split(' ');}
	static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
	static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
	static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;

namespace ConsoleApplication1
{
    class item
    {
        public item(int index, int value)
        {
            this.index = index;
            this.value = value;
        }
        public int index;
        public int value;
    }
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            string[] splits = input.Split(' ');
            int n = int.Parse(splits[0]);
            int m = int.Parse(splits[1]);
            splits = Console.ReadLine().Split(' ');
            Queue<item> queue = new Queue<item>();

            for (int i = 0; i < splits.Length; i++)
            {
                item it = new item(i + 1, int.Parse(splits[i]));
                queue.Enqueue(it);
            }

            while (queue.Count > 1)
            {
                item it = queue.Dequeue();
                if (it.value > m)
                {
                    it.value -= m;
                    queue.Enqueue(it);
                }
            }

            Console.WriteLine(queue.Dequeue().index);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Jzzhu_and_Children
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] r = Console.ReadLine().Split(' ');
            int n = int.Parse(r[0]);
            int m = int.Parse(r[1]);
            int[] a = new int[n];
            string[] t = Console.ReadLine().Split(' ');
            for (int i = 0; i < n; i++) a[i] = int.Parse(t[i]);
            int br0 = 0;
            for (int i = 0; i < n; i++)
            {
                if (a[i] != 0)
                {
                    if (br0 == n - 1)
                    {
                        Console.WriteLine(i + 1);
                        return;
                    }
                    if (a[i] > m) a[i] -= m;
                    else
                    {
                        a[i] = 0;
                        br0++;
                    }
                }
                if (i == n - 1) i = -1;
            }
        }
    }
}

using System;
using System.Dynamic;
using System.Linq;

namespace _450_A_Jzzhu_and_Children
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');

            int n = int.Parse(s[0]);
            int m = int.Parse(s[1]);
            int last=n;
            string[] s1 = Console.ReadLine().Split(' ');
            int[] a = Array.ConvertAll(s1, int.Parse);

            while (a.Sum() != 0)
            {
                for (int i = 0; i < a.Length; i++)
                {
                    if (a[i] > m)
                    {
                        a[i] = a[i] - m;
                        last = i + 1;
                    }
                    else
                    {
                        a[i] = 0;
                    }
                }
            }

            Console.WriteLine(last);
        }
    }
}

using System;
using System.Collections.Generic;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string fr = Console.ReadLine();
            string sr = Console.ReadLine();

            var q = new Queue<KeyValuePair<int, int>>();

            int m = int.Parse(fr.Split(' ')[1]);

            var elems = sr.Split(' ');
            for (int i = 0; i < elems.Length; i++)
                q.Enqueue(new KeyValuePair<int, int>(i+1, int.Parse(elems[i])));

            bool isOver = false;
            int id = 0;

            while(!isOver)
            {
                var elem = q.Dequeue();
                elem = new KeyValuePair<int, int>(elem.Key, elem.Value - m);
                q.Enqueue(elem);
                isOver = true;
                foreach(var el in q)
                {
                    if (el.Value > 0)
                        isOver = false;
                }
                if (isOver)
                    id = elem.Key;
            }

            Console.WriteLine(id);
           // Console.ReadKey();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Text;

namespace _257div
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');

            int n = int.Parse(s[0]);
            int m = int.Parse(s[1]);
            int max = 0;
            int ind = n;

            string[] ss = Console.ReadLine().Split();

            int[] st = new int[n];

            for (int i = 0; i < n; i++)
            {
                st[i] = int.Parse(ss[i])/m;

                if (int.Parse(ss[i])%m >0)
                {
                    st[i]++;
                }
            }

            for (int i = 0; i < n; i++)
            {
                if (st[i]  >=max)
                {
                    max = st[i];
                    ind = i + 1;
                }
            }

            Console.WriteLine(ind);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Text;

namespace Round_257
{
   public class MyClass
    {
        public int value { get; set; }
        public int number { get; set; }

       public MyClass(int v, int n)
       {
           value = v;
           number = n;
       }
    }
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int n = Convert.ToInt32(s[0]);
            int m = Convert.ToInt32(s[1]);
            s = Console.ReadLine().Split(' ');
            int max = -1;
            int ans = 0, tmp = 0;
            List<MyClass> mas = new List<MyClass>();
            for (int i = 0; i < n; i++)
            {
                tmp = int.Parse(s[i]);
                mas.Add(new MyClass(tmp,i+1));
            }
            int h = 0;
            while (mas.Count!=1)
            {
                if (mas[h].value > m)
                {
                    mas[h].value -= m;
                    h++;
                }
                else
                {
                    mas.RemoveAt(h);
                }
                if (h > mas.Count - 1)
                {
                    h = 0;
                }
            }
            Console.WriteLine(mas[0].number);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApp1
{
    internal class Program
    {

        private static void Main(string[] args)
        {
            string input = Console.ReadLine();
            int n = int.Parse(input.Split(' ')[0]);
            int m = int.Parse(input.Split(' ')[1]);

            var inputs = Array.ConvertAll(Console.ReadLine().Split(' '), s => int.Parse(s));
            int max = 0;
            int last = 0;
            for(int i=0;i<n;i++)
            {
                int x = ( inputs[i] -1 )/m;
                if (x > max)
                {
                    max = x;
                    last = i + 1;
                }
                else if( x == max)
                {
                    last = i + 1;
                }
            }

            Console.WriteLine(last);
          //  Console.ReadKey();
        }

        // Console.ReadKey();

    }

}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _450A
{
    class item
    {
        public int index;
        public int value;
        public item(int index,int value)
        {
            this.index = index;
            this.value = value;
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
            string[] l1 = Console.ReadLine().Split();
            int n = int.Parse(l1[0]), m = int.Parse(l1[1]);
            int[] a = Console.ReadLine().Split().Select(_ => int.Parse(_)).ToArray();
            Queue<item> q = new Queue<item>();
            for(int i = 0;i<n;i++)
            {
                item it = new item(i + 1, a[i]);
                q.Enqueue(it);
            }
            while (q.Count != 1)
            {
                item curChild = q.Dequeue();
                if (curChild.value > m)
                {
                    curChild.value -= m;
                    q.Enqueue(curChild);
                }
            }
            Console.WriteLine(q.Dequeue().index);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Jzzhu_and_Children
{
    class Program
    {
        static void Main(string[] args)
        {
            string line;
            int n,m;
            line = Console.ReadLine();
            string[] tokens = line.Split();
            n = int.Parse(tokens[0]);
            m = int.Parse(tokens[1]);
            line = Console.ReadLine();
            string[] token = line.Split();
            int[] a = Array.ConvertAll(token, int.Parse);
            int mx =-1,id=0;
            for (int i = 0; i < n; i++)
            {
                a[i] += m - 1;
                a[i] /= m;
            }
            for (int i = n-1; i >=0; i--)
                if (a[i] > mx)
                {
                    mx = a[i];
                    id = i + 1;
                }
            Console.WriteLine(id + "\n");
        }
    }
}

using System;

public class Program
{
	public static void Main()
	{
            string txt = Console.ReadLine();
            string[] nums = txt.Split(' ');
            int n = Convert.ToInt32(nums[0]), k = Convert.ToInt32(nums[1]), candall=0;
            txt = Console.ReadLine(); nums = txt.Split(' ');
            int[] a = new int[n];
            for ( int i1=0; i1<n; i1++)
            {
                a[i1] = Convert.ToInt32(nums[i1]);
                candall += a[i1];
            }
            int i = -1;
            while (candall!=0)
            {
                i++;
                if (i == n)
                    i = 0;
                if ( a[i] >k)
                {
                    a[i] -= k;candall -= k;
                }
                else if ( a[i] !=0)
                {
                    candall -= a[i]; a[i] = 0;
                }
            }
            Console.WriteLine(i+1);
	}
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
public class Solver
{
    public void Solve()
    {
        int n = ReadInt();
        int m = ReadInt();
        int[] a = ReadIntArray();
        var q = new System.Collections.Generic.Queue<int>(a);
        var numsQ = new System.Collections.Generic.Queue<int>(Enumerable.Range(1, a.Count()));
        int last = -1;
        while (q.Any())
        {
            last = numsQ.Dequeue();
            int value = q.Dequeue();
            if (value > m)
            {
                q.Enqueue(value - m);
                numsQ.Enqueue(last);
            }
        }
        Write(last);
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;
    static void Main()
    {
#if DEBUG
        // reader = new StreamReader("..\\..\\input.txt");
        reader = new StreamReader(Console.OpenStandardInput());
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());
        //reader = new StreamReader("input.txt");
        //writer = new StreamWriter("output.txt");
#endif
        try
        {
            new Solver().Solve();
            //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);
            //thread.Start();
            //thread.Join();
        }
        catch
        {
#if DEBUG
            // Console.WriteLine(ex);
#else
            throw;
#endif
        }
        reader.Close();
        writer.Close();
    }

    #endregion

    #region Read / Write
    private static Queue<string> currentLineTokens = new Queue<string>();
    private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\t', }, StringSplitOptions.RemoveEmptyEntries); }
    public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue<string>(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }
    public static int ReadInt() { return int.Parse(ReadToken()); }
    public static long ReadLong() { return long.Parse(ReadToken()); }
    public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }
    public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }
    public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }
    public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }
    public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }
    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;
    }
    public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }
    public static void WriteArray<T>(IEnumerable<T> array) { writer.WriteLine(string.Join(" ", array)); }
    public static void Write(params object[] array) { WriteArray(array); }
    public static void WriteLines<T>(IEnumerable<T> array) { foreach (var a in array)writer.WriteLine(a); }
    private class SDictionary<TKey, TValue> : Dictionary<TKey, TValue>
    {
        public new TValue this[TKey key]
        {
            get { return ContainsKey(key) ? base[key] : default(TValue); }
            set { base[key] = value; }
        }
    }
    private static T[] Init<T>(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }
    #endregion
}

using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] z = Array.ConvertAll(Console.ReadLine().Split(' '), x => int.Parse(x));
            int[] ppl = Array.ConvertAll(Console.ReadLine().Split(' '), x => int.Parse(x));
            int numberOfPeople = z[0];
            int candiesPerTurn = z[1];
            Queue<Person> queue = new Queue<Person>();

            //Fill data
            for (int i = 1; i <= numberOfPeople; i++)
            {
                queue.Enqueue(new Person(i, ppl[i - 1]));
            }

            int lastChild = 0;

            while (queue.Any())
            {
                if (queue.Count == 1)
                {
                    lastChild = queue.Peek().id;
                }

                Person turn = queue.Dequeue();
                turn.neededCandies -= candiesPerTurn;
                if (turn.neededCandies > 0)
                {
                    queue.Enqueue(turn);
                }
            }

            Console.WriteLine(lastChild);
            Console.Read();
        }

        public struct Person
        {
            public int id;
            public int neededCandies;

            public Person(int i, int candies)
            {
                id = i;
                neededCandies = candies;
            }
        }
    }
}

using System;
 public class Program
    {
        public static void Main(string[] args)
        {
            string[] input = Console.In.ReadToEnd().Split(new char[] { ' ', '\t', '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
            int index = -1;
            int moves = -1;
            int m = int.Parse(input[1]);
            for(int i = 2, curr; i<input.Length; i++)
            {
                curr = int.Parse(input[i]);
                curr = curr / m + (curr % m > 0 ? 1 : 0);
                if(curr>=moves) { moves = curr; index = i; }
            }
            Console.WriteLine(index - 1);
        }
    }

using System;
using System.Collections.Generic;
using System.Linq;
using Solver.Ex;
using Debug = System.Diagnostics.Debug;
using Watch = System.Diagnostics.Stopwatch;
using StringBuilder = System.Text.StringBuilder;
using System.Numerics;
namespace Solver
{
    public class Solver
    {
        public void Solve()
        {
            var n = sc.Integer();
            var m = sc.Integer();
            var a = sc.Integer(n);
            var b = new int[n];
            var used = new bool[n];
            var pos = 0;
            var count = 0;
            while (true)
            {
                if (used[pos]) { pos = (pos + 1) % n; continue; }
                b[pos] += m;
                if (a[pos] <= b[pos]) { count++; used[pos] = true; }
                if (count == n) break;
                pos = (pos + 1) % n;
            }
            IO.Printer.Out.WriteLine(pos+1);

        }
        internal IO.StreamScanner sc;
        static T[] Enumerate<T>(int n, Func<int, T> f) { var a = new T[n]; for (int i = 0; i < n; i++) a[i] = f(i); return a; }

    }
    #region Main and Settings
    static class Program
    {
        static void Main(string[] arg)
        {
#if DEBUG
            var errStream = new System.IO.FileStream(@"..\..\dbg.out", System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite);
            Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(errStream, "debugStream"));
            Debug.AutoFlush = false;
            var sw = new Watch(); sw.Start();
            IO.Printer.Out.AutoFlush = true;
            try
            {
#endif

                var solver = new Solver();
                solver.sc = new IO.StreamScanner(Console.OpenStandardInput());
                solver.Solve();
                IO.Printer.Out.Flush();
#if DEBUG
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex.Message);
                Console.Error.WriteLine(ex.StackTrace);
            }
            finally
            {
                sw.Stop();
                Console.ForegroundColor = ConsoleColor.Green;
                Console.Error.WriteLine("Time:{0}ms", sw.ElapsedMilliseconds);
                Debug.Close();
                System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
            }
#endif
        }

    }
    #endregion
}

#region IO Helper
namespace Solver.IO
{
    public class Printer : System.IO.StreamWriter
    {
        static Printer()
        {
            Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false };
#if DEBUG
            Error = new Printer(Console.OpenStandardError()) { AutoFlush = true };
#else
            Error = new Printer(System.IO.Stream.Null) { AutoFlush = false };
#endif
        }
        public static Printer Out { get; set; }
        public static Printer Error { get; set; }
        public override IFormatProvider FormatProvider { get { return System.Globalization.CultureInfo.InvariantCulture; } }
        public Printer(System.IO.Stream stream) : base(stream, new System.Text.UTF8Encoding(false, true)) { }
        public Printer(System.IO.Stream stream, System.Text.Encoding encoding) : base(stream, encoding) { }
        public void Write<T>(string format, IEnumerable<T> source) { base.Write(format, source.OfType<object>().ToArray()); }
        public void WriteLine<T>(string format, IEnumerable<T> source) { base.WriteLine(format, source.OfType<object>().ToArray()); }
    }
    public class StreamScanner
    {
        public StreamScanner(System.IO.Stream stream) { iStream = stream; }
        private readonly System.IO.Stream iStream;
        private readonly byte[] buf = new byte[1024];
        private int len, ptr;
        private bool eof = false;
        public bool IsEndOfStream { get { return eof; } }
        const byte lb = 33, ub = 126, el = 10, cr = 13;
        public byte read()
        {
            if (eof) throw new System.IO.EndOfStreamException();
            if (ptr >= len) { ptr = 0; if ((len = iStream.Read(buf, 0, 1024)) <= 0) { eof = true; return 0; } }
            return buf[ptr++];
        }
        public char Char() { byte b = 0; do b = read(); while (b < lb || ub < b); return (char)b; }
        public char[] Char(int n) { var a = new char[n]; for (int i = 0; i < n; i++) a[i] = Char(); return a; }
        public char[][] Char(int n, int m) { var a = new char[n][]; for (int i = 0; i < n; i++) a[i] = Char(m); return a; }
        public string Scan()
        {
            if (eof) throw new System.IO.EndOfStreamException();
            StringBuilder sb = null;
            var enc = System.Text.UTF8Encoding.Default;
            do
            {
                for (; ptr < len && (buf[ptr] < lb || ub < buf[ptr]); ptr++) ;
                if (ptr < len) break;
                ptr = 0;
                if ((len = iStream.Read(buf, 0, 1024)) <= 0) { eof = true; return ""; }
            } while (true);
            do
            {
                var f = ptr;
                for (; ptr < len; ptr++)
                    if (buf[ptr] < lb || ub < buf[ptr])
                    //if (buf[ptr] == cr || buf[ptr] == el)
                    {
                        string s;
                        if (sb == null) s = enc.GetString(buf, f, ptr - f);
                        else { sb.Append(enc.GetChars(buf, f, ptr - f)); s = sb.ToString(); }
                        ptr++; return s;
                    }
                if (sb == null) sb = new StringBuilder(enc.GetString(buf, f, len - f));
                else sb.Append(enc.GetChars(buf, f, len - f));
                ptr = 0;

            }
            while (!eof && (len = iStream.Read(buf, 0, 1024)) > 0);
            eof = true; return (sb != null) ? sb.ToString() : "";
        }
        public long Long()
        {
            long ret = 0; byte b = 0; bool isMynus = false;
            const byte zr = 48, nn = 57, my = 45;
            do b = read();
            while (b != my && (b < zr || nn < b));
            if (b == my) { isMynus = true; b = read(); }
            for (; true; b = read())
                if (b < zr || nn < b)
                    return isMynus ? -ret : ret;
                else ret = ret * 10 + b - zr;
        }
        public int Integer()
        {
            int ret = 0; byte b = 0; bool isMynus = false;
            const byte zr = 48, nn = 57, my = 45;
            do b = read();
            while (b != my && (b < zr || nn < b));
            if (b == my) { isMynus = true; b = read(); }
            for (; true; b = read())
                if (b < zr || nn < b)
                    return isMynus ? -ret : ret;
                else ret = ret * 10 + b - zr;
        }
        public double Double() { return double.Parse(Scan(), System.Globalization.CultureInfo.InvariantCulture); }
        public string[] Scan(int n) { var a = new string[n]; for (int i = 0; i < n; i++) a[i] = Scan(); return a; }
        public double[] Double(int n) { var a = new double[n]; for (int i = 0; i < n; i++) a[i] = Double(); return a; }
        public int[] Integer(int n) { var a = new int[n]; for (int i = 0; i < n; i++) a[i] = Integer(); return a; }
        public long[] Long(int n) { var a = new long[n]; for (int i = 0; i < n; i++)a[i] = Long(); return a; }
        public void Flush() { iStream.Flush(); }
    }
}
#endregion
#region Extension
namespace Solver.Ex
{
    static public partial class EnumerableEx
    {
        static public string AsString(this IEnumerable<char> ie) { return new string(ie.ToArray()); }
        static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") { return string.Join(st, ie); }

    }
}
#endregion

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
namespace Practise
{
    class Program
    {
        public static void Main()
        {
            int n, m;
            String[] input;

            input = Console.ReadLine().Split();
            n = Convert.ToInt32(input[0]);
            m = Convert.ToInt32(input[1]);

            input = Console.ReadLine().Split();
            int lastTurn = 0;
            int lastId = 0;
            for (int i = 0; i < n; i++)
            {
                int demand = Convert.ToInt32(input[i]);
                int turn = (demand + (m-1))/ m;
                if (turn >= lastTurn)
                {
                    lastTurn = turn;
                    lastId = i+1;
                }
            }
            Console.WriteLine(lastId);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var n = 0;
            var m = 0;
            var str1 = Console.ReadLine().Split(' ');
            n = int.Parse(str1[0]);
            m = int.Parse(str1[1]);
            var kol = n;
            var children = new int[1000];
            var str = Console.ReadLine().Split(' ');

            for (int i = 0; i < n; i++)
            {
                children[i] = int.Parse(str[i]);
            }

            for (;;)
            {
                for (int i = 0; i < n; i++)
                {
                    if (children[i] > 0)
                    {
                        children[i] -= m;
                    if (children[i] <= 0)
                    {
                        kol--;
                        if (kol == 0)
                        {
                            Console.WriteLine(i + 1);
                            return;
                        }
                    }
                    }
                }
            }

        }
    }
}

using System;
using System.Linq;

class A450 {
    public static void Main() {
        var line = Console.ReadLine().Split();
        var n = int.Parse(line[0]);
        var m = int.Parse(line[1]);
        var a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        for (int i = 0; i < n; ++i) a[i] = (a[i] + m - 1) / m;
        Console.WriteLine(Array.LastIndexOf(a, a.Max()) + 1);
    }
}

using System;

namespace R_A_Jzzhu
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int n = int.Parse(s[0]);
            double max = 1, m = double.Parse(s[1]);
            int[] a = new int[n];
            s = Console.ReadLine().Split(' ');
            for (int i = 0; i < n; i++)
            {
                a[i] = int.Parse(s[i]);
                if (a[i] > max) max = a[i];
            }
            double k = Math.Ceiling(max / m), ans = 0;
            for (int i = n - 1; i >= 0; i--)
            {
                if (Math.Ceiling(a[i] / m) == k)
                {
                    ans = i + 1;
                    break;
                }
            }
            Console.WriteLine(ans);
            Console.ReadLine();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Jzzhu_and_Children
{
    class Program
    {
        static IO io = new IO();
        static void Main(string[] args)
        {
            int num_N = io.ReadNextInt();
            float num_M = io.ReadNextInt();
            int num_Ans = Console.ReadLine().Split()
                .Select((x, i) => new { value = Math.Ceiling(int.Parse(x) / num_M), Id = i })
                .OrderByDescending(x => x.value).ThenByDescending(x => x.Id)
                .First().Id;

            io.PutStr(++num_Ans);
            io.ReadLong();
        }
    }
    class IO
    {
        private static Queue<string> currentLineTokens = new Queue<string>();
        private static string[] ReadAndSplitLine()
        {
            return Console.ReadLine().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
        }
        public int ReadNextInt()
        {
            return int.Parse(ReadToken());
        }
        public int ReadNum()
        {
            return Convert.ToInt32(Console.ReadLine());
        }
        public long ReadLong()
        {
            return Convert.ToInt64(Console.ReadLine());
        }
        public string ReadStr()
        {
            return Console.ReadLine();
        }
        public string[] ReadStrArr()
        {
            return Console.ReadLine().Split(' ');
        }
        public int[] ReadIntArr()
        {
            return Array.ConvertAll<string, int>(Console.ReadLine().Split(' '), s => int.Parse(s));
        }
        public void PutStr(string str)
        {
            Console.WriteLine(str);
        }
        public void PutStr(int str)
        {
            Console.WriteLine(str);
        }
        public void PutStr(long str)
        {
            Console.WriteLine(str);
        }

        public static string ReadToken()
        {
            while (currentLineTokens.Count == 0)
                currentLineTokens = new Queue<string>(ReadAndSplitLine());
            return currentLineTokens.Dequeue();
        }
    }
}

using System;
using System.Linq;
class demo
{
    static void Main()
    {
        float m = float.Parse(Console.ReadLine().Split()[1]);
        int a = Console.ReadLine().Split()
            .Select((x, i) => new { val = Math.Ceiling(int.Parse(x) / m), id = i })
            .OrderByDescending(x => x.val).ThenByDescending(x => x.id)
            .First().id;
        Console.WriteLine(++a);
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Pr1
{
    class Program
    {
        static void Main()
        {
            var ab= Array.ConvertAll(Console.ReadLine().Split(' '), Convert.ToInt32);
            var a= Array.ConvertAll(Console.ReadLine().Split(' '), Convert.ToInt32);
            int k=0,w=0;
            for(int i=0;i<ab[0];i++)
            {
                int q=(int)Math.Ceiling((double)a[i]/ab[1]);
                if(q>=k)
                {
                    k=q;
                    w=i+1;
                }
            }
            Console.Write(w);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CSharpConsoleApp
{
    class Program
    {
        public struct Child
        {
            public int Number;

            public int Cnt;
        }

        static void Main(string[] args)
        {
            string[] toks = Console.ReadLine().Split();
            int n = int.Parse(toks[0]);
            int m = int.Parse(toks[1]);

            toks = Console.ReadLine().Split();

            Queue<Child> q = new Queue<Child>();

            for (int i = 0; i < n; i++)
            {
                q.Enqueue(new Child() { Number = i + 1, Cnt = int.Parse(toks[i]) });
            }

            int result = -1;
            while (q.Count > 0)
            {
                Child c = q.Dequeue();
                result = c.Number;
                c.Cnt -= m;
                if (c.Cnt > 0)
                    q.Enqueue(c);

            }

            Console.WriteLine(result);
        }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace a
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int child = int.Parse(str[0]);
            int candy = int.Parse(str[1]);
            string[] candystr = Console.ReadLine().Split(' ');
            Queue<int> childque = new Queue<int>();
            Queue<int> candyque = new Queue<int>();
            for (int i = 1; i <= child; i++)
            {
                childque.Enqueue(i);
                candyque.Enqueue(int.Parse(candystr[i-1]));
            }
            for(;;)
            {
                int nowchild = childque.Dequeue();
                int nowcandy = candyque.Dequeue() - candy;
                if (nowcandy > 0)
                {
                    childque.Enqueue(nowchild);
                    candyque.Enqueue(nowcandy);
                }
                if (candyque.Count() == 0)
                {
                    Console.WriteLine(nowchild);
                    return;
                }
            }
        }
    }
}

using System;
using System.IO;
using System.Text;

namespace Jzzhu_and_Children
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            int n = Next();
            int m = Next();

            int max = 0;
            int index = -1;
            for (int i = 0; i < n; i++)
            {
                int count = (Next() + m - 1)/m;
                if (count >= max)
                {
                    max = count;
                    index = i + 1;
                }
            }

            writer.WriteLine(index);
            writer.Flush();
        }

        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;

namespace ConsoleApplication1
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var s = Console.ReadLine().Split(' ');
            var n = int.Parse(s[0]);
            var m = int.Parse(s[1]);
            s = Console.ReadLine().Split(' ');
            var a = new int[n];
            var l = n;
            for (var i = 0; i < n; i++)
            {
                a[i] = int.Parse(s[i]);
            }
            while (l > 1)
            {
                for (var i = 0; i < n; i++)
                {
                    if (a[i] > 0)
                    {
                        a[i] -= m;

                        if (a[i] <= 0)
                            l--;
                    }
                    if (l == 1)
                        break;
                }
            }
            for (var i = 0; i < n; i++)
            {
                if (a[i] <= 0) continue;
                Console.WriteLine(i+1);
                return;
            }
        }
    }
}

#if DEBUG
using System.Reflection;
using System.Threading.Tasks;
#endif

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Numerics;
using System.Globalization;

namespace _257a
{
    class Program
    {
        static string _inputFilename = "input.txt";
        static string _outputFilename = "output.txt";
        static bool _useFileInput = false;

        static void Main(string[] args)
        {
            StreamWriter file = null;
#if DEBUG
			Console.SetIn(getInput());
#else
            if (_useFileInput)
            {
                Console.SetIn(File.OpenText(_inputFilename));
                file = new StreamWriter(_outputFilename);
                Console.SetOut(file);
            }
#endif

            try
            {
                solution();
            }
            finally
            {
                if (_useFileInput)
                {
                    file.Close();
                }
            }
        }

        static void solution()
        {
            #region SOLUTION
            var d = readIntArray();
            var n = d[0];
            var m = d[1];
            var a = readIntArray();
            var s = new Queue<Tuple<int, int>>();
            for (int i = 0; i < n; i++)
            {
                s.Enqueue(Tuple.Create(i + 1, a[i]));
            }

            var last = -1;
            while (true)
            {
                if (s.Count == 0)
                {
                    break;
                }

                var f = s.Dequeue();
                last = f.Item1;
                if (f.Item2 <= m)
                {
                    continue;
                }
                else
                {
                    s.Enqueue(Tuple.Create(last, f.Item2 - m));
                }
            }

            Console.WriteLine(last);

            //var n = readInt();
            //var m = readInt();

            //var a = readIntArray();
            //var b = readIntArray();
            #endregion
        }

        static int readInt()
        {
            return int.Parse(Console.ReadLine());
        }

        static long readLong()
        {
            return long.Parse(Console.ReadLine());
        }

        static int[] readIntArray()
        {
            return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();
        }

        static long[] readLongArray()
        {
            return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();
        }

#if DEBUG
		static StreamReader getInput()
		{
			var resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];
			var resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);

			return new StreamReader(resource);
		}
#endif
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using System.IO;
using System.Numerics;
using System.Globalization;
using System.Threading;

namespace probleme {
    class Program {
        static void Main(string[] args) {
            //Console.SetIn(new StreamReader("file.txt"));
            Dictionary<string, string> d = new Dictionary<string, string>();
            string[] s = Console.ReadLine().Split(' ');
            int n = int.Parse(s[0]), m = int.Parse(s[1]);
            int[] v = Array.ConvertAll(Console.ReadLine().Split(' '), tz => int.Parse(tz));
            int ans = 0, max = 0;
            for (int i = 0; i < n; i++) {
                int c = v[i] / m;
                if (v[i] % m != 0)
                    c++;
                if (c >= max) {
                    max = c;
                    ans = i + 1;
                }
            }
            Console.Write(ans);
            //  Console.ReadKey();
        }
    }
}

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace CF_R257
{
    public class Task_A
    {
        static void Main(string[] args)
        {
#if !ONLINE_JUDGE
            Console.SetIn(new StreamReader(@"a_input.txt"));
#endif
            new Task_A().Solve();
        }

        private void Solve()
        {
            var parts = Console.ReadLine().Split();
            var n = int.Parse(parts[0]);
            var m = int.Parse(parts[1]);
            var a = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var q = new Queue<Tuple<int, int>>();

            for (int i = 0; i < n; i++)
            {
                var child = new Tuple<int, int>(i+1, a[i]);
                q.Enqueue(child);
            }

            var last = -1;
            while (q.Count != 0)
            {
                var child = q.Dequeue();
                if (child.Item2 > m)
                {
                    q.Enqueue(new Tuple<int, int>(child.Item1, child.Item2 - m));
                }
                else
                {
                    last = child.Item1;
                }
            }

            Console.WriteLine(last);
        }
    }
}

using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace CodeForces.PRACTICE
{
    // Jzzhu and Children (implementation)
    class _450A
    {
        static void Main(string[] args)
        {
            string[] ss = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            int n = int.Parse(ss[0]);
            int m = int.Parse(ss[1]);
            ss = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = int.Parse(ss[i]);
            int max = 0;
            int maxPos = -1;
            for (int i = n - 1; i >= 0; i--)
            {
                int db = a[i] / m + Math.Sign(a[i] % m);
                if (db > max) { max = db; maxPos = i; }
            }
            Console.WriteLine(maxPos + 1);
        }
    }
}

using System;
using System.Collections.Generic;
class Program
{
    class Entity
    {
        public int Count { get; set; }

        public int Number { get; set; }
    }
    public static void Main(string[] args)
    {
        string[] input = Console.In.ReadLine().Split(new char[] { ' '}, StringSplitOptions.RemoveEmptyEntries);
        int n = Int32.Parse(input[0]);
        int m = Int32.Parse(input[1]);
        var queue = new Queue<Entity>();
        input = Console.In.ReadLine().Split(new char[] { ' '}, StringSplitOptions.RemoveEmptyEntries);
        for(int i = 0; i < n; i++)
        {
            var entity = new Entity()
            {
                Number = i + 1,
                Count = Int32.Parse(input[i])
            };
            queue.Enqueue(entity);
        }
        int lastNumber = -1;
        while(queue.Count != 0)
        {
            Entity next = queue.Dequeue();
            next.Count -= m;
            lastNumber = next.Number;
            if(next.Count > 0)
            {
                queue.Enqueue(next);
            }
        }
        Console.WriteLine(lastNumber);
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Globalization;

namespace Codeforces
{
    class A
    {
        //*

        static void ReadStr(int[] a, int n)
        {
            string s = Console.ReadLine();
            if (n == 1)
            {
                a[0] = Convert.ToInt32(s);
                return;
            }
            string[] splitstr = s.Split(' ');

            for (int i = 0; i < n; i++)
            {
                a[i] = Convert.ToInt32(splitstr[i]);
            }
        }
        static void Main(string[] args)
        {

            string s = Console.ReadLine();
            string[] splitStr = s.Split(' ');
            int n = Convert.ToInt32(splitStr[0]);
            int m = Convert.ToInt32(splitStr[1]);

            int[] a = new int[n];
            ReadStr(a, n);

            int max = -1;
            int ind = -1;
            for (int i = 0; i < n; i++)
            {
                if ((a[i]-1) / m >= max)
                {
                    max = (a[i]-1) / m;
                    ind = i;
                }
            }
            Console.WriteLine(ind+1);

        }
         /**/
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CodeForces
{
    class Program
    {
        static void Main(string[] args)
        {
            int n;
            int m;
            Input.Next(out n, out m);
            int[] input = Input.ArrayInt().ToArray();
            int output = GetLastChildGoingHome(input, m);
            Console.WriteLine(output);

        }

        public static int GetLastChildGoingHome(int[] inputs, int candies)
        {
            for (int i = 0; i < inputs.Length; i++)
            {
                inputs[i] = inputs[i] % candies == 0 ? inputs[i] / candies : ((inputs[i] / candies) + 1);
            }

            int last = 0;
            int lastIdx = 0;

            for (int i = 0; i < inputs.Length; i++)
            {
                if (inputs[i] >= last)
                {
                    last = inputs[i];
                    lastIdx = i;
                }
            }

            return lastIdx + 1;
        }
    }

    public class Input
    {
        private static string _line;

        public static bool Next()
        {
            _line = Console.ReadLine();
            return _line != null;
        }

        public static bool Next(out long a)
        {
            var ok = Next();
            a = ok ? long.Parse(_line) : 0;
            return ok;
        }

        public static bool Next(out long a, out long b)
        {
            var ok = Next();
            if (ok)
            {
                var array = _line.Split(' ').Select(long.Parse).ToArray();
                a = array[0];
                b = array[1];
            }
            else
            {
                a = b = 0;
            }

            return ok;
        }

        public static bool Next(out long a, out long b, out long c)
        {
            var ok = Next();
            if (ok)
            {
                var array = _line.Split(' ').Select(long.Parse).ToArray();
                a = array[0];
                b = array[1];
                c = array[2];
            }
            else
            {
                a = b = c = 0;
            }
            return ok;
        }

        public static bool Next(out long a, out long b, out long c, out long d)
        {
            var ok = Next();
            if (ok)
            {
                var array = _line.Split(' ').Select(long.Parse).ToArray();
                a = array[0];
                b = array[1];
                c = array[2];
                d = array[3];
            }
            else
            {
                a = b = c = d = 0;
            }
            return ok;
        }

        public static bool Next(out long a, out long b, out long c, out long d, out long e)
        {
            var ok = Next();
            if (ok)
            {
                var array = _line.Split(' ').Select(long.Parse).ToArray();
                a = array[0];
                b = array[1];
                c = array[2];
                d = array[3];
                e = array[4];
            }
            else
            {
                a = b = c = d = e = 0;
            }
            return ok;
        }

        public static bool Next(out int a)
        {
            var ok = Next();
            a = ok ? int.Parse(_line) : 0;
            return ok;
        }

        public static bool Next(out int a, out int b)
        {
            var ok = Next();
            if (ok)
            {
                var array = _line.Split(' ').Select(int.Parse).ToArray();
                a = array[0];
                b = array[1];
            }
            else
            {
                a = b = 0;
            }

            return ok;
        }

        public static bool Next(out int a, out int b, out int c)
        {
            var ok = Next();
            if (ok)
            {
                var array = _line.Split(' ').Select(int.Parse).ToArray();
                a = array[0];
                b = array[1];
                c = array[2];
            }
            else
            {
                a = b = c = 0;
            }
            return ok;
        }

        public static bool Next(out int a, out int b, out int c, out int d)
        {
            var ok = Next();
            if (ok)
            {
                var array = _line.Split(' ').Select(int.Parse).ToArray();
                a = array[0];
                b = array[1];
                c = array[2];
                d = array[3];
            }
            else
            {
                a = b = c = d = 0;
            }
            return ok;
        }

        public static bool Next(out int a, out int b, out int c, out int d, out int e)
        {
            var ok = Next();
            if (ok)
            {
                var array = _line.Split(' ').Select(int.Parse).ToArray();
                a = array[0];
                b = array[1];
                c = array[2];
                d = array[3];
                e = array[4];
            }
            else
            {
                a = b = c = d = e = 0;
            }
            return ok;
        }

        public static bool Next(out int a, out int b, out int c, out int d, out int e, out int f)
        {
            var ok = Next();
            if (ok)
            {
                var array = _line.Split(' ').Select(int.Parse).ToArray();
                a = array[0];
                b = array[1];
                c = array[2];
                d = array[3];
                e = array[4];
                f = array[5];
            }
            else
            {
                a = b = c = d = e = f = 0;
            }
            return ok;
        }

        public static IEnumerable<long> ArrayLong()
        {
            return !Next() ? new List<long>() : _line.Split().Select(long.Parse);
        }

        public static IEnumerable<int> ArrayInt()
        {
            return !Next() ? new List<int>() : _line.Split().Select(int.Parse);
        }

        public static int[,] GetMatrix(int rows, int cols)
        {
            int[,] matrix = new int[rows, cols];
            int row = 0;
            int col = 0;
            while (Next())
            {
                IEnumerable<int> numbers =  _line.Split().Select(int.Parse);
                IEnumerator<int> iter = numbers.GetEnumerator();
                while (iter.MoveNext())
                {
                    matrix[row, col++] = iter.Current;
                }
                row++;
                col = 0;
            }
            return matrix;
        }

        public static bool Next(out string value)
        {
            value = string.Empty;
            if (!Next()) return false;
            value = _line;
            return true;
        }
    }

}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CF_JzzhuChildren
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] t = Console.ReadLine().Split(' ');
            int n = int.Parse(t[0]);
            int m = int.Parse(t[1]);
            List<int> a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse).ToList();
            List<int> index = Enumerable.Range(0, a.Count()).ToList();
            while(a.Count() >1)
            {
                if(a[0] <= m)
                {
                    a.RemoveAt(0);
                    index.RemoveAt(0);
                }
                else
                {
                    a[0] = a[0] - m;
                    a.Add(a[0]);
                    a.RemoveAt(0);
                    index.Add(index[0]);
                    index.RemoveAt(0);
                }
            }
            Console.WriteLine(index[0] + 1);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');

            int n = int.Parse(s[0]);
            int m = int.Parse(s[1]);

            string[] s2 = Console.ReadLine().Split(' ');

            int[] mas = new int[n];
            for (int i = 0; i < n; i++)
            {
                mas[i] = int.Parse(s2[i]);
            }

            int j = 0;
            int count = 0;
            while (true)
            {
                if (mas[j] > 0)
                {
                    mas[j] -= m;
                    if (mas[j] <= 0) count++;
                    if (count >= n) break;
                }
                j++;
                j %= n;
            }
            Console.WriteLine(j + 1);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;

namespace coder
{
    class Program
    {
        static void Main(string[] args)
        {
            byte[] inputBuffer = new byte[1024];
            System.IO.Stream inputStream = Console.OpenStandardInput(inputBuffer.Length);
            Console.SetIn(new StreamReader(inputStream, Console.InputEncoding, false, inputBuffer.Length));

            int n, m, index=0;
            int[] a = new int[101];
            string arr;
            bool b = false;
            string[] arr1 = Console.ReadLine().Split(new Char[] { ' ' });

            n = int.Parse(arr1[0]);
            m = int.Parse(arr1[1]);

            arr = Console.ReadLine();
            arr1 = Regex.Split(arr, " ");

            for (int i = 0; i < n; i++)
            {
                a[i] = int.Parse(arr1[i]);
            }

            while(!b)
            {
                for (int i = 0; i < n; i++)
                {
                    if(a[i]>0)
                    {
                        a[i] = a[i] - m;
                        index = i+1;
                        b = true;
                    }
                }
                if (b == false)
                {
                    b = true;
                }
                else { b = false; }
            }

            Console.WriteLine(index);
        }
    }
}

using System;
using System.Collections.Generic;
using System.IO;

namespace prA {

    class Program {
#if ONLINE_JUDGE
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);
#else
        private static readonly StreamWriter writer = new StreamWriter("output");
        private static readonly StreamReader reader = new StreamReader("input");
#endif
        static void Main(string[] args) {
            int n = Next();
            int m = Next();
            int[] a = new int[n];
            List<int> ai = new List<int>();
            for(int i = 0; i < n; i++) {
                a[i] = Next();
                ai.Add(i);
            }
            int ans = 1;
            while(ai.Count > 0) {
                ans = ai[ai.Count - 1];
                List<int> newai = new List<int>();
                foreach(int t in ai) {
                    a[t] -= m;
                    if(a[t] > 0)
                        newai.Add(t);
                }
                ai.Clear();
                ai.AddRange(newai);
            }
            writer.WriteLine(ans + 1);

            writer.Flush();
#if !ONLINE_JUDGE
            writer.Close();
#endif
        }
        private static int Next() {
            int c;
            int res = 0;
            do {
                c = reader.Read();
                if(c == -1)
                    return res;
            } while(c != '-' && (c < '0' || c > '9'));
            int sign = 1;
            if(c == '-') {
                sign = -1;
                c = reader.Read();
            }
            res = c - '0';
            while(true) {
                c = reader.Read();
                if(c < '0' || c > '9')
                    return res * sign;
                res *= 10;
                res += c - '0';
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;

public class Solver
{
    public object Solve()
    {
        int n = ReadInt();
        int m = ReadInt();
        var a = ReadIntArray();

        int max = 0;
        int nmax = -1;
        for (int i = 0; i < n; i++)
        {
            int x = (a[i] - 1) / m + 1;
            if (x >= max)
            {
                max = x;
                nmax = i;
            }
        }

        return nmax + 1;
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;

    static void Main()
    {
#if DEBUG
        reader = new StreamReader("..\\..\\input.txt");
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = Console.In;
        writer = new StreamWriter(Console.OpenStandardOutput());
#endif
        try
        {
            var ts = DateTime.Now;
            object result = new Solver().Solve();
            if (result != null)
                writer.WriteLine(result);
        }
        catch (Exception ex)
        {
#if DEBUG
            Console.WriteLine(ex);
#else
            throw;
#endif
        }
        reader.Close();
        writer.Close();
    }

    #endregion

    #region Read/Write

    private static Queue<string> currentLineTokens = new Queue<string>();

    private static string[] ReadAndSplitLine()
    {
        return reader.ReadLine().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public static string ReadToken()
    {
        while (currentLineTokens.Count == 0)
            currentLineTokens = new Queue<string>(ReadAndSplitLine());
        return currentLineTokens.Dequeue();
    }

    public static int ReadInt()
    {
        return int.Parse(ReadToken());
    }

    public static long ReadLong()
    {
        return long.Parse(ReadToken());
    }

    public static double ReadDouble()
    {
        return double.Parse(ReadToken(), CultureInfo.InvariantCulture);
    }

    public static int[] ReadIntArray()
    {
        return ReadAndSplitLine().Select(int.Parse).ToArray();
    }

    public static long[] ReadLongArray()
    {
        return ReadAndSplitLine().Select(long.Parse).ToArray();
    }

    public static double[] ReadDoubleArray()
    {
        return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();
    }

    public static int[][] ReadIntMatrix(int numberOfRows)
    {
        int[][] matrix = new int[numberOfRows][];
        for (int i = 0; i < numberOfRows; i++)
            matrix[i] = ReadIntArray();
        return matrix;
    }

    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows);
        int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++)
        {
            ret[i] = new int[numberOfRows];
            for (int j = 0; j < numberOfRows; j++)
                ret[i][j] = matrix[j][i];
        }
        return ret;
    }

    public static string[] ReadLines(int quantity)
    {
        string[] lines = new string[quantity];
        for (int i = 0; i < quantity; i++)
            lines[i] = reader.ReadLine().Trim();
        return lines;
    }

    public static void WriteArray<T>(IEnumerable<T> array)
    {
        writer.WriteLine(string.Join(" ", array));
    }

    #endregion
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;

namespace ConsoleApplication252
{

    class Program
    {

        static bool P(int n)
        {
            for (int i = 2; i <= Math.Sqrt(n); i++)
            {
                if (n % i == 0)
                {
                    return false;
                }
            }
            return true;
        }
        static bool Need(int[] m)
        {
            for (int i = 0; i < m.Length; i++)
            {
                if (m[i] > 0)
                {
                    return false;
                }
            }
            return true;
        }
        static void Main()
        {
            string[] ss = Console.ReadLine().Split();
            int n = int.Parse(ss[0]);
            int m = int.Parse(ss[1]);
            string[] s = Console.ReadLine().Split();
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = int.Parse(s[i]);
            }
            int p = 0;
            while (true)
            {
                if (Need(a))
                {
                    break;
                }
                for (int i = 0; i < n; i++)
                {
                    if (a[i] > 0)
                    {
                        a[i] -= m;
                        p = i + 1;
                    }
                }
            }
            Console.WriteLine(p);

        }
    }
}

using System;
using System.Linq;
using System.Collections.Generic;

namespace tren
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] nm = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            List<int> list = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
            List<int> res = new List<int>();
            for (int i = 0; i < nm[0]; i++)
            {
                res.Add(Convert.ToInt32(Math.Ceiling((double)list[i] / nm[1])));
            }
            Console.Write(res.LastIndexOf(res.Max()) + 1);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//using System.Threading.Tasks;

namespace Problem450A {
    class Program {
        static int distributeCandy(Queue<int[]> childrenQueue, int nOfChildren, int firstDistribution) {
            int lastChildrenIndex = 0;
            while (childrenQueue.Count > 0) {
                if (childrenQueue.Count == 1) {
                    int[] lastChildren = childrenQueue.Dequeue();
                    lastChildrenIndex = lastChildren[1];
                    break;
                }

                int[] actChildren = childrenQueue.Dequeue();
                if (firstDistribution < actChildren[0]) {
                    int[] actChildren1 = new int[2] { actChildren[0] - firstDistribution, actChildren[1] };
                    childrenQueue.Enqueue(actChildren1);
                }

            }

            return lastChildrenIndex;
        }

        static void Main(string[] args) {
            string[] input1 = Console.ReadLine().Split(' ');
            string[] input2 = Console.ReadLine().Split(' ');

            int nOfChildren = Convert.ToInt32(input1[0]);
            int firstDistribution = Convert.ToInt32(input1[1]);
            Queue<int[]> childrenQueue = new Queue<int[]>();
            for (int i = 0; i < nOfChildren; i++) {
                int actChilden = Convert.ToInt32(input2[i]);
                int position = i+1;
                int[] tmp = new int[2] {actChilden, position};
                childrenQueue.Enqueue(tmp);
            }

            int lastChildren = distributeCandy(childrenQueue, nOfChildren, firstDistribution);
            Console.WriteLine(lastChildren);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    public class Program
    {
        public static void Main()
        {
            int[] parameters, children;
            int i = -1;

            parameters = Console.ReadLine().Split(' ').Select(n => Convert.ToInt32(n)).ToArray();
            children = Console.ReadLine().Split(' ').Select(n => Convert.ToInt32(n)).ToArray();

            while (true)
            {
                ++i;

                if (i == children.Length)
                    i = 0;

                if (children.Sum() == children[i])
                    break;

                if (children[i] != 0)
                {
                    children[i] -= parameters[1];

                    if (children[i] < 0)
                        children[i] = 0;
                }
            }

            Console.WriteLine(i + 1);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numerics;
using System.Text.RegularExpressions;
using System.Globalization;

namespace WarmingUpC_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] NM = Array.ConvertAll<string, int>(Console.ReadLine().Split(' '), int.Parse);
            int n = NM[0], m = NM[1];
            int[] a = Array.ConvertAll<string, int>(Console.ReadLine().Split(' '), int.Parse);
            Queue<int> line = new Queue<int>();
            Queue<int> candies = new Queue<int>();
            for (int i = 1; i <= n; i++)
            {
                line.Enqueue(i);
                candies.Enqueue(a[i - 1]);
            }
            while (line.Count > 1)
            {
                int pivot = candies.Dequeue() - m;
                if (pivot <= 0)
                {
                    line.Dequeue();
                }
                else
                {
                    int index = line.Dequeue();
                    candies.Enqueue(pivot);
                    line.Enqueue(index);
                }
            }
            Console.WriteLine(line.Dequeue());
        }
    }
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
public class Solver
{
    #region Main
    protected static TextReader reader;
    protected static TextWriter writer;
    static void Main()
    {
        reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);
        writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);
        var n = ReadInt();
        var m = ReadInt();
        var a = ReadIntArray();
        int i = 0, h = -1;
        while (a.Any(z => z > 0))
        {
            if (a[i % n] - m > 0)
            {
                a[i % n] -= m;
            }
            else
            {
                a[i % n] = h--;
            }
            i++;
        }
        writer.WriteLine(Array.IndexOf(a, a.Min()) + 1);
        reader.Close();
        writer.Close();
    }
    #endregion
    #region Read / Write

    private static Queue<string> currentLineTokens = new Queue<string>();

    private static string[] ReadAndSplitLine()
    {
        return reader.ReadLine().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public static string ReadToken()
    {
        while (currentLineTokens.Count == 0)
            currentLineTokens = new Queue<string>(ReadAndSplitLine());
        return currentLineTokens.Dequeue();
    }

    public static int ReadInt()
    {
        return int.Parse(ReadToken());
    }

    public static long ReadLong()
    {
        return long.Parse(ReadToken());
    }

    public static double ReadDouble()
    {
        return double.Parse(ReadToken(), CultureInfo.InvariantCulture);
    }

    public static int[] ReadIntArray()
    {
        return ReadAndSplitLine().Select(int.Parse).ToArray();
    }

    public static long[] ReadLongArray()
    {
        return ReadAndSplitLine().Select(long.Parse).ToArray();
    }

    public static double[] ReadDoubleArray()
    {
        return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();
    }

    public static int[][] ReadIntMatrix(int numberOfRows)
    {
        int[][] matrix = new int[numberOfRows][];
        for (int i = 0; i < numberOfRows; i++)
            matrix[i] = ReadIntArray();
        return matrix;
    }

    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows);
        int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++)
        {
            ret[i] = new int[numberOfRows];
            for (int j = 0; j < numberOfRows; j++)
                ret[i][j] = matrix[j][i];
        }
        return ret;
    }

    public static string[] ReadLines(int quantity)
    {
        string[] lines = new string[quantity];
        for (int i = 0; i < quantity; i++)
            lines[i] = reader.ReadLine().Trim();
        return lines;
    }

    public static void WriteArray<T>(IEnumerable<T> array)
    {
        writer.WriteLine(string.Join(" ", array));
    }

    public static void Write<T>(params T[] array)
    {
        WriteArray(array);
    }

    public static void WriteLines<T>(IEnumerable<T> array)
    {
        foreach (var a in array)
            writer.WriteLine(a);
    }

    #endregion
}

using System;
using System.Linq;
public class VJ
{
    static int Main()
    {
        process();
        Console.ReadLine();
        return 0;
    }
    static void process()
    {
        int[] nm=Array.ConvertAll<string , int>(Console.ReadLine().Split(' ') , r => int.Parse(r));
        int[] ar=Array.ConvertAll<string , int>(Console.ReadLine().Split(' ') , r => int.Parse(r));
        int max=0;
        bool f=true;
        while(f)
        {
            f=false;
            for(int i=0;i<nm[0];i++)
            {
                if(ar[i]>0)
                {
                    ar[i]-=nm[1];
                    max=i;
                    f=true;
                }
            }
        }
        Console.WriteLine(max+1);
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Int32 n, m, i, k;
            String input=Console.ReadLine();
            String[] inputsplit = input.Split(' ');
            n = Convert.ToInt32(inputsplit[0]);
            k = n;
            Int32[] a = new Int32[n];
            m = Convert.ToInt32(inputsplit[1]);
            input = Console.ReadLine();
            inputsplit = input.Split(' ');
            for (i = 0; i < n; i++)
            {
                a[i] = Convert.ToInt32(inputsplit[i]);
            }
            i=0;
            while (true)
            {
                if (a[i] > 0){
                    a[i] -= m;
                    if (a[i] <= 0)
                        k--;
                }
                if (k == 0)
                {
                    Console.WriteLine(i+1);
                    return;
                }
                i=(i+1)%n;
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Generic
{
    class Program
    {
        static void Main(string[] args)
        {

            var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var n = input[0];
            var m = input[1];

            input = Console.ReadLine().Split().Select(int.Parse).ToArray();

            int max = (input[0] - 1) / m;
            int maxIndex = 1;
            int tmp;
            for (int i = 1; i < n; i++)
            {
                tmp = (input[i] - 1) / m;
                if (tmp >= max)
                {
                    max = tmp;
                    maxIndex = i + 1;
                }
            }

            Console.WriteLine(maxIndex);

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;

namespace CodeF1
{
    class X
    {
        public int val { get; set; }
        public int I { get; set; }

    }
    class Program
    {
        private static void Main()
        {
            var a =
                Console.ReadLine()
                    .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                    .Select(Int32.Parse)
                    .ToArray();
            var n = a[0];
            var m = a[1];

            a =
                Console.ReadLine()
                    .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                    .Select(Int32.Parse)
                    .ToArray();

            var list = new List<X>();

            for (int i = 0; i < n; i++)
            {
                list.Add(new X() { I = i + 1, val = a[i] });
            }

            var listB = new List<X>();

            while (list.Count > 0)
            {

                for (int i = 0; i < list.Count; i++)
                {
                    if (list[i].val > m)
                    {
                        listB.Add(new X() { val = list[i].val - m, I = list[i].I });
                    }

                }
                if (listB.Count == 0)
                {
                    Console.WriteLine(list[list.Count - 1].I);
                    return;
                }
                else
                {
                    list = listB;
                    listB = new List<X>();
                }
            }

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace codeforces450A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n, m;
            var a = Console.ReadLine().Split(' ');
            n = int.Parse(a[0]);
            m = int.Parse(a[1]);

            int max = 0, index = 0;
            a = Console.ReadLine().Split(' ');
            for (int i = 0; i < n; i++)
            {
                int r = (int.Parse(a[i]) - 1) / m;
                if (r >= max)
                {
                    max = r;
                    index = i;
                }
            }
            Console.WriteLine(index + 1);
            Console.Read();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace codeforces450A
{
    class Program
    {
        struct dat
        {
            public byte i, need;
            public static dat cr(int i,int need)
            {
                dat d;
                d.i = (byte)i;
                d.need = (byte)need;
                return d;
            }
        }
        static void Main(string[] args)
        {
            byte n, m;
            Queue<dat> q = new Queue<dat>();
            var a = Console.ReadLine().Split(' ');
            n = (byte)int.Parse(a[0]);
            m = (byte)int.Parse(a[1]);

            a = Console.ReadLine().Split(' ');
            for (int i = 1; i <= n; i++)
            {
                q.Enqueue(dat.cr(i, (byte)int.Parse(a[i - 1])));
            }
            while(q.Count >1)
            {
                dat d = q.First();
                if(d.need >m)
                {
                    d.need -= m;
                    q.Dequeue();
                    q.Enqueue(d);
                }
                else
                {
                    q.Dequeue();
                }
            }
            Console.WriteLine(q.First().i);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Round257
{
    class A
    {
        class Child
        {
            public int rank;
            public int candies;
        }

        static void Main(string[] args)
        {
            int n, m;
            ReadIntegers(out n, out m);

            List<int> candies = ReadIntegerList();
            List<Child> children = new List<Child>();
            for (int i = 0; i < n; i++)
            {
                Child c = new Child();
                c.rank = i + 1;
                c.candies = candies[i];

                children.Add(c);
            }

            int lastChild = 0;
            while (children.Count > 0)
            {
                if (children[0].candies <= m)
                {
                    lastChild = children[0].rank;
                }
                else
                {
                    Child c = new Child();
                    c.rank = children[0].rank;
                    c.candies = children[0].candies - m;

                    children.Add(c);
                }

                children.RemoveAt(0);
            }

            Console.WriteLine(lastChild);
        }

        #region InputRoutines
        static string RString()
        {
            return Console.ReadLine();
        }

        static void ReadInteger(out int a)
        {
            a = int.Parse(Console.ReadLine());
        }

        static void ReadIntegers(out int a, out int b)
        {
            int[] inputInt = ReadIntegerArray();

            a = inputInt[0];
            b = inputInt[1];
        }

        static void ReadIntegers(out int a, out int b, out int c)
        {
            int[] inputInt = ReadIntegerArray();

            a = inputInt[0];
            b = inputInt[1];
            c = inputInt[2];
        }

        static int[] ReadIntegerArray()
        {
            List<int> integerList = new List<int>();
            RString().Split(" ".ToArray())
                     .ToList()
                     .ForEach(e => integerList.Add(int.Parse(e)));

            return integerList.ToArray();
        }

        static long[] ReadLongArray()
        {
            List<long> longList = new List<long>();
            RString().Split(" ".ToArray())
                     .ToList()
                     .ForEach(e => longList.Add(long.Parse(e)));

            return longList.ToArray();
        }

        static List<int> ReadIntegerList()
        {
            List<int> integerList = new List<int>();
            RString().Split(" ".ToArray())
                     .ToList()
                     .ForEach(e => integerList.Add(int.Parse(e)));

            return integerList;
        }
        #endregion
    }
}

using System;

namespace ConsoleApplication10
{
    class Program
    {
        static int zeroo=0;
        static int k = 0;
        static void Main(string[] args)
        {
            int childs;
            int candies;
            int fatchild;
            int fatchildAt;
            string input;
            int[] kidsline;
                fatchild = 0;
                fatchildAt = 0;
                input = Console.ReadLine();
                childs = Convert.ToInt32(input.Split(' ')[0]);
                candies = Convert.ToInt32(input.Split(' ')[1]);
                kidsline = new int[childs];
                input = Console.ReadLine();
                if(kidsline[0] > candies)
                fatchild = kidsline[0];
                else
                fatchild = 0;
                while (isInt(kidsline) == false)
                {
                    for (int a = 0; a < childs; a++)
                    {
                        if (k == 0)
                        {
                            kidsline[a] = Convert.ToInt32(input.Split(' ')[a]);
                            if (!(kidsline[a] >= 1 && kidsline[a] <= 100))
                                continue;
                        }
                        if (k != 0)
                        {
                            if ((kidsline[a] >= fatchild && kidsline[a] > candies) || (zeroo == kidsline.Length && kidsline[a] > 0 && k != 0))
                            {
                                fatchild = kidsline[a];
                                fatchildAt = a + 1;
                            }
                            kidsline[a] -= candies;
                            zeroo = 0;
                            if (isInt(kidsline) == true)
                            {
                                if (zeroo == kidsline.Length)
                                    fatchildAt = a+1;
                                break;
                            }
                        }
                    }
                    k++;
                    zeroo=0;
                }
                if (fatchildAt == 0)
                    fatchildAt = kidsline.Length;
                Console.WriteLine(fatchildAt);
        }
        public static bool isInt(int[] kidsline)
        {
            bool zeros = false;
            int zero = 0;
            foreach (var item in kidsline)
            {
                if (item <= 0)
                {
                    zero++;
                    zeroo++;
                }
            }
            if (zero == kidsline.Length && k !=0)
                zeros = true;
            return zeros;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CF
{
    class Program
    {
        static void Main(string[] args)
        {

            String[] input = Console.ReadLine().Split(' ');
            long n = Int64.Parse(input[0]);
            long m = Int64.Parse(input[1]);
            input = Console.ReadLine().Split(' ');

            List<long> longList = new List<long>();
            long max = 0;
            long temp = 0;
            for (int i = 0; i < n; i++)
            {
                temp = Int64.Parse(input[i]);
                longList.Add(temp);
                if (temp > max) max = temp;
            }

            int j = longList.Count;
            while (longList.ElementAt(j-1) < (max - 1) / m * m + 1) j--;

            Console.WriteLine(j);

        }
    }
}

using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Runtime.Remoting.Messaging;
using System.Security;
using System.Security.Cryptography.X509Certificates;
using System.Text;

namespace codeforces
{
	class Program
	{
		public class User
		{
			public int c;

			public int r;
		}

		public class Comparer : IComparer<User>
		{
			public int Compare(User x, User y)
			{
				if (x.c < y.c)
					return -1;
				return 1;
			}
		}

		public static long getGcd(long a, long b)
		{
			if (b == 0)
				return a;
			return getGcd(b, a % b);
		}

		public static void WriteYESNO(bool x, string yes = "YES", string no = "NO")
		{
			if (x)
				Console.WriteLine(yes);
			else
			{
				Console.WriteLine(no);
			}
		}

		public static string GetString()
		{
			return Console.ReadLine();
		}

		public static List<int> getList()
		{
			var s = Console.ReadLine();
			return s.Split(' ').Select(int.Parse).ToList();
		}

		public static int Min(int x, int y)
		{
			return Math.Min(x, y);
		}

		public static int Max(int x, int y)
		{
			return Math.Max(x, y);
		}

		public static int Abs(int x)
		{
			return Math.Abs(x);
		}

		public static int getInt()
		{
			var s = Console.ReadLine();
			return int.Parse(s);
		}

		public static bool Equal(int x, int y, int x1, int y1)
		{
			return x == x1 && y == y1;
		}

		public class Vertex
		{
			public List<int> edges;

			public int ct;

			public Vertex()
			{
				ct = 0;
				edges = new List<int>();
				for (var i = 0; i < 26; ++i)
					edges.Add(0);
			}
		}

		private static void Main(string[] args)
		{
/*			var input = new StreamReader("input.txt");
			var output = new StreamWriter("output.txt");*/
			var arr = getList();
			var n = arr[0];
			var m = arr[1];
			arr = getList();
			var ans = 1;
			var max = arr[0] / m + (arr[0] % m != 0 ? 1 : 0);
			for (var i = 1; i < n; ++i)
			{
				var p = arr[i] / m + (arr[i] % m != 0 ? 1 : 0);
				if (p >= max)
				{
					ans = i + 1;
					max = p;
				}
			}
			Console.WriteLine(ans);
			/*			input.Close();
			output.Close();*/
		}
	}
}

//brain disabled
using System;

namespace Моё
{
    static class Решение
    {
        static void Main()
        {
            int n,m;
            var z = Console.ReadLine().Split(' ');
            n = Convert.ToInt32(z[0]);
            m = Convert.ToInt32(z[1]);
            z = Console.ReadLine().Split(' ');
            int ans = 0, val = -1;
            for(int i=0;i<n;++i)
            {
               if((Convert.ToInt32(z[i])+m-1)/m >= val)
               {
                   ans = i+1;
                   val = (Convert.ToInt32(z[i])+m-1)/m;
               }
            }

            Console.WriteLine(ans);
        }
    }
}

using System;

public class Test
{
	public static void Main()
	{
		int n, k, j, m, max, i;
		i = 0;
		max = 0;
		j = 0;
        string[] s = Console.ReadLine().Split();
        n = int.Parse(s[0]);
        m = int.Parse(s[1]);
        int[] a = new int[n];
        string[] line = Console.ReadLine().Split();
        while (j < n)
        {
        	a[j] = int.Parse(line[j]);
            k = (a[j] - 1 + m)/m;
            if( k > max)
            {
            	max = k;
            	i = j;
            }
            if( k == max)
            {
            	i = j;
            }
            j ++;

        }
        Console.WriteLine(i+1);
	}
}

using System;
using System.Linq;

namespace _450A
{
    class Program
    {
        static void Main()
        {
            var s = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var n = s[0]; var m = s[1];
            int lastIndex = 0, counter = n;
            var queue = Console.ReadLine().Split().Select(int.Parse).ToArray();
            while (counter > 0)
            {
                for (int i = 0; i < n; i++)
                {
                    if (queue[i] > 0)
                    {
                        queue[i] -= m;
                        if (queue[i] <= 0) counter--;
                    }
                    if (counter == 0) { lastIndex = i; break; }

                }
            }
            Console.WriteLine(lastIndex+1);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeForcesTemplate
{
    class Program
    {
        struct Child
        {
            public int Candies;
            public int Number;
            public Child(int candies, int number)
            {
                Candies = candies;
                Number = number;
            }
        }
        static int n;
        static int m;
        static Queue<Child> children;

        static void Main(string[] args)
        {
            LoadInput();

            Solve();
        }

        private static void Solve()
        {
            while (children.Count != 1)
            {
                var currentChild = children.Dequeue();
                currentChild.Candies -= m;
                if (currentChild.Candies > 0)
                {
                    children.Enqueue(currentChild);
                }
            }
            Console.WriteLine(children.Dequeue().Number);
        }

        private static void LoadInput()
        {
            var inp = Console.ReadLine().Split(' ');
            n = int.Parse(inp[0]);
            m = int.Parse(inp[1]);
            children = new Queue<Child>(Console.ReadLine().Split(' ').Select((candiesNeeded, index) => new Child(int.Parse(candiesNeeded), index + 1)));
        }
    }

    static class Helpers
    {
        public static void Print<T>(this IEnumerable<T> source)
        {
            foreach (var item in source)
            {
                Console.Write("{0} ", item.ToString());
            }
            Console.WriteLine();
        }
    }
}

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

#region ioh

class Scanner
{
    private readonly TextReader reader;
    private string[] buffer;
    private int bufferPos;

    public Scanner()
        : this(null)
    { }

    public Scanner(TextReader reader)
    {
        this.reader = reader ?? Console.In;
        buffer = new string[0];
    }

    public string NextTerm()
    {
        if (bufferPos >= buffer.Length)
        {
            buffer = reader.ReadLine().Split(' ');
            bufferPos = 0;
        }

        return buffer[bufferPos++];
    }

    public int NextInt()
    {
        return int.Parse(NextTerm());
    }

    public int[] NextIntArray()
    {
        return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
    }

    public int[][] NextIntMatrix(int rowCount)
    {
        var matrix = new int[rowCount][];

        for (int i = 0; i < matrix.Length; i++)
        {
            matrix[i] = NextIntArray();
        }

        return matrix;
    }
}

#endregion

class Program
{
    private static readonly Scanner s = new Scanner();

    static void Main(string[] args)
    {
        s.NextInt();
        var m = s.NextInt();

        var arr = s.NextIntArray();

        var l = arr.Length;

        var res = -1;

        while (true)
        {
            for (int i = 0; i < arr.Length; i++)
            {
                if (l == 1 && arr[i] > 0)
                {
                    res = i + 1;
                    break;
                }

                if (arr[i] > 0)
                {
                    arr[i] -= m;
                    if (arr[i] <= 0) l--;
                }
            }

            if (res != -1) break;
        }

        Console.WriteLine(res);
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Jzzhu_and_Children
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int n = Int32.Parse(input[0]);
            int m = Int32.Parse(input[1]);
            int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);
            int[] b = new int[n];
            for (int i = 0; i < n; i++)
                b[i] = i + 1;
            Array.Sort(a, b);
            bool exist = false;
            for (int i = 0; i < n; i++)
            {
                if (a[i] > m)
                    exist = true;
            }
            if (exist)
                Console.WriteLine(b[n - 1]);
            else
                Console.WriteLine(n);
            Console.ReadLine();
        }
    }
}

using System;
using System.Dynamic;
using System.Linq;

namespace _450_A_Jzzhu_and_Children
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');

            int n = int.Parse(s[0]);
            int m = int.Parse(s[1]);
            int last=0;
            string[] s1 = Console.ReadLine().Split(' ');
            int[] a = Array.ConvertAll(s1, int.Parse);

            while (a.Sum() != 0)
            {
                for (int i = 0; i < a.Length; i++)
                {
                    if (a[i] > m)
                    {
                        a[i] = a[i] - m;
                        last = i + 1;
                    }
                    else
                    {
                        a[i] = 0;
                    }
                }
            }

            Console.WriteLine(last);
        }
    }
}

using System;
using System.Dynamic;

namespace _450_A_Jzzhu_and_Children
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');

            int n = int.Parse(s[0]);
            int m = int.Parse(s[1]);
            int last = n;
            string[] s1 = Console.ReadLine().Split(' ');
            int[] a = Array.ConvertAll(s1, int.Parse);
            for (int i = 0; i < a.Length; i++)
            {
                if (a[i] > m)
                {
                    a[i] = a[i] - m;
                    last = i + 1;
                }
            }
            Console.WriteLine(last);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Text;

namespace _257div
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');

            int n = int.Parse(s[0]);
            int m = int.Parse(s[1]);
            int max = m;
            int ind = n;
            string[] ss = Console.ReadLine().Split();

            int[] st = new int[n];

            for (int i = 0; i < n; i++)
            {
                st[i] = int.Parse(ss[i])/m;
                if (int.Parse(ss[i])%m >0)
                {
                    st[i]++;
                }
            }

            for (int i = 0; i < n; i++)
            {
                if (st[i]  >=max)
                {
                    max = st[i];
                    ind = i + 1;
                }
            }

            Console.WriteLine(ind);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Text;

namespace Round_257
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int n = Convert.ToInt32(s[0]);
            int m = Convert.ToInt32(s[1]);
            s = Console.ReadLine().Split(' ');
            int max = -1;
            int ans = 0, tmp = 0;
            for (int i = 0; i < n; i++)
            {
                tmp = int.Parse(s[i])/m;
                if (tmp>= max)
                {
                    max = tmp;
                    ans = i + 1;
                }
            }
            Console.WriteLine(ans);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApp1
{
    internal class Program
    {

        private static void Main(string[] args)
        {
            string input = Console.ReadLine();
            int n = int.Parse(input.Split(' ')[0]);
            int m = int.Parse(input.Split(' ')[1]);

            var inputs = Array.ConvertAll(Console.ReadLine().Split(' '), s => int.Parse(s));
            int max = 0;
            int last = 0;
            for(int i=0;i<n;i++)
            {
                int x = inputs[i];
                if (x > max)
                {
                    max = x;
                    last = i + 1;
                }
                else if( x == max)
                {
                    last = i + 1;
                }
            }

            Console.WriteLine(last);
           // Console.ReadKey();
        }

        // Console.ReadKey();

    }

}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Jzzhu_and_Children
{
    class Program
    {
        static void Main(string[] args)
        {
            string line;
            int n,m;
            line = Console.ReadLine();
            string[] tokens = line.Split();
            n = int.Parse(tokens[0]);
            m = int.Parse(tokens[1]);
            line = Console.ReadLine();
            string[] token = line.Split();
            int[] a = Array.ConvertAll(token, int.Parse);
            int mx =-1,id=0;
            for (int i = n-1; i >=0; i--)
                if (a[i] > mx)
                {
                    mx = a[i];
                    id = i + 1;
                }
            Console.WriteLine(id + "\n");
        }
    }
}

using System;
using System.IO;
using System.Text;

namespace Jzzhu_and_Children
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            int n = Next();
            int m = Next();

            int max = 0;
            int index = -1;
            for (int i = 0; i < n; i++)
            {
                int count = Next()/m;
                if (count >= max)
                {
                    max = count;
                    index = i + 1;
                }
            }

            writer.WriteLine(index);
            writer.Flush();
        }

        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Globalization;

namespace Codeforces
{
    class A
    {
        //*

        static void ReadStr(int[] a, int n)
        {
            string s = Console.ReadLine();
            if (n == 1)
            {
                a[0] = Convert.ToInt32(s);
                return;
            }
            string[] splitstr = s.Split(' ');

            for (int i = 0; i < n; i++)
            {
                a[i] = Convert.ToInt32(splitstr[i]);
            }
        }
        static void Main(string[] args)
        {

            string s = Console.ReadLine();
            string[] splitStr = s.Split(' ');
            int n = Convert.ToInt32(splitStr[0]);
            int m = Convert.ToInt32(splitStr[1]);

            int[] a = new int[n];
            ReadStr(a, n);

            int max = -1;
            int ind = -1;
            for (int i = 0; i < n; i++)
            {
                if ((a[i]-1) / m >= max)
                {
                    max = a[i] / m;
                    ind = i;
                }
            }
            Console.WriteLine(ind+1);

        }
         /**/
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Globalization;

namespace Codeforces
{
    class A
    {
        //*

        static void ReadStr(int[] a, int n)
        {
            string s = Console.ReadLine();
            if (n == 1)
            {
                a[0] = Convert.ToInt32(s);
                return;
            }
            string[] splitstr = s.Split(' ');

            for (int i = 0; i < n; i++)
            {
                a[i] = Convert.ToInt32(splitstr[i]);
            }
        }
        static void Main(string[] args)
        {

            string s = Console.ReadLine();
            string[] splitStr = s.Split(' ');
            int n = Convert.ToInt32(splitStr[0]);
            int m = Convert.ToInt32(splitStr[1]);

            int[] a = new int[n];
            ReadStr(a, n);

            int max = -1;
            int ind = -1;
            for (int i = 0; i < n; i++)
            {
                if (a[i] / m >= max)
                {
                    max = a[i] / m;
                    ind = i;
                }
            }
            Console.WriteLine(ind+1);

        }
         /**/
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace coder
{
    class Program
    {
        static void Main(string[] args)
        {
            int n, m, max = 0, index=0;
            bool b =  false;
            int[] a = new int[101];
            string[] arr1 = Console.ReadLine().Split(new Char[] { ' ' });

            n = int.Parse(arr1[0]);
            m = int.Parse(arr1[1]);

            arr1 = Console.ReadLine().Split(new Char[] { ' ' });

            for (int i = 0; i < n; i++)
            {
                a[i] = int.Parse(arr1[i]);
                if (max <= a[i])
                {
                    max = a[i];
                    if (max > m)
                    {
                        index = i+1;
                        b = true;
                    }
                }
            }
            if (!b)
            {
                index = n;
            }
            Console.WriteLine(index);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;

namespace coder
{
    class Program
    {
        static void Main(string[] args)
        {
            byte[] inputBuffer = new byte[1024];
            System.IO.Stream inputStream = Console.OpenStandardInput(inputBuffer.Length);
            Console.SetIn(new StreamReader(inputStream, Console.InputEncoding, false, inputBuffer.Length));

            int n, m, max = 0, index=0;
            bool b =  false;
            int[] a = new int[101];
            string arr;
            string[] arr1 = Console.ReadLine().Split(new Char[] { ' ' });

            n = int.Parse(arr1[0]);
            m = int.Parse(arr1[1]);

            arr = Console.ReadLine();
            arr1 = Regex.Split(arr, " ");

            for (int i = 0; i < n; i++)
            {
                a[i] = int.Parse(arr1[i]);
                if (max <= a[i])
                {
                    max = a[i];

                    if (max > m)
                    {
                        index = i+1;
                        b = true;
                    }
                }
            }
            if (!b)
            {
                index = n;
            }
            Console.WriteLine(index);
        }
    }
}

using System;
using System.Collections.Generic;
using System.IO;

namespace prA {

    class Program {
#if ONLINE_JUDGE
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);
#else
        private static readonly StreamWriter writer = new StreamWriter("output");
        private static readonly StreamReader reader = new StreamReader("input");
#endif
        static void Main(string[] args) {
            int n = Next();
            int m = Next();
            int ans = 1;
            int aa = Next();
            for(int i = 1; i < n; i++) {
                int a = Next();
                if(a > aa) {
                    aa = a;
                    ans = i + 1;
                }
            }
            if(aa <= m) {
                ans = n;
            }
            writer.WriteLine(ans);

            writer.Flush();
#if !ONLINE_JUDGE
            writer.Close();
#endif
        }
        private static int Next() {
            int c;
            int res = 0;
            do {
                c = reader.Read();
                if(c == -1)
                    return res;
            } while(c != '-' && (c < '0' || c > '9'));
            int sign = 1;
            if(c == '-') {
                sign = -1;
                c = reader.Read();
            }
            res = c - '0';
            while(true) {
                c = reader.Read();
                if(c < '0' || c > '9')
                    return res * sign;
                res *= 10;
                res += c - '0';
            }
        }
    }
}

using System;
using System.Linq;
using System.Collections.Generic;

namespace tren
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] nm = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            List<int> list = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
            if(list.Max() > nm[1])
            {
                Console.Write(list.IndexOf(list.Where(x => x > nm[1]).Last()) + 1);
                return;
            }
            else
            {
                Console.Write(list.Count());
            }
        }
    }
}

using System;
using System.Linq;
using System.Collections.Generic;

namespace tren
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] nm = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            List<int> list = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
            Console.Write(list.LastIndexOf(list.Max()) + 1);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//using System.Threading.Tasks;

namespace Problem450A {
    class Program {
        static int distributeCandy(Queue<int[]> childrenQueue, int nOfChildren, int firstDistribution) {
            int lastChildrenIndex = 0;
            while (childrenQueue.Count > 0) {
                int[] actChildren = childrenQueue.Dequeue();
                if (firstDistribution < actChildren[0]) {
                    int[] actChildren1 = new int[2] { actChildren[0] - firstDistribution, actChildren[1] };
                    childrenQueue.Enqueue(actChildren1);
                }

                if (childrenQueue.Count == 1) {
                    int[] lastChildren = childrenQueue.Dequeue();
                    lastChildrenIndex = lastChildren[1];
                }
            }

            return lastChildrenIndex;
        }

        static void Main(string[] args) {
            string[] input1 = Console.ReadLine().Split(' ');
            string[] input2 = Console.ReadLine().Split(' ');

            int nOfChildren = Convert.ToInt32(input1[0]);
            int firstDistribution = Convert.ToInt32(input1[1]);
            Queue<int[]> childrenQueue = new Queue<int[]>();
            for (int i = 0; i < nOfChildren; i++) {
                int actChilden = Convert.ToInt32(input2[i]);
                int position = i+1;
                int[] tmp = new int[2] {actChilden, position};
                childrenQueue.Enqueue(tmp);
            }

            int lastChildren = distributeCandy(childrenQueue, nOfChildren, firstDistribution);
            Console.WriteLine(lastChildren);
        }
    }
}

using System;
using System.Linq;
public class VJ
{
    static int Main()
    {
        process();
        Console.ReadLine();
        return 0;
    }
    static void process()
    {
        int[] nm=Array.ConvertAll<string , int>(Console.ReadLine().Split(' ') , r => int.Parse(r));
        int[] ar=Array.ConvertAll<string , int>(Console.ReadLine().Split(' ') , r => int.Parse(r));
        int max=nm[0]-1;
        for(int i=nm[0]-2;i>=0;i--)
        {
            if(ar[i]>ar[max]) max=i;
        }
        if(ar[max]<nm[1]) Console.WriteLine(nm[0]);
        else Console.WriteLine(max+1);
    }
}

using System;
using System.Linq;
public class VJ
{
    static int Main()
    {
        process();
        Console.ReadLine();
        return 0;
    }
    static void process()
    {
        int[] nm=Array.ConvertAll<string , int>(Console.ReadLine().Split(' ') , r => int.Parse(r));
        int[] ar=Array.ConvertAll<string , int>(Console.ReadLine().Split(' ') , r => int.Parse(r));
        int max=nm[0]-1;
        for(int i=nm[0]-2;i>=0;i--)
        {
            if(ar[i]>ar[max]) max=i;
        }
        Console.WriteLine(max+1);
    }
}

using System;
using System.Linq;
public class VJ
{
    static int Main()
    {
        process();
        Console.ReadLine();
        return 0;
    }
    static void process()
    {
        int[] nm=Array.ConvertAll<string , int>(Console.ReadLine().Split(' ') , r => int.Parse(r));
        int[] ar=Array.ConvertAll<string , int>(Console.ReadLine().Split(' ') , r => int.Parse(r));
        int max=nm[0]-1;
        for(int i=nm[0]-2;i>=0;i--)
        {
            if(ar[i]>ar[max]) max=i;
        }
        if(ar[max]<nm[1]) Console.WriteLine(ar[0]);
        else Console.WriteLine(max+1);
    }
}

using System;

namespace ConsoleApplication10
{
    class Program
    {
        static int zeroo=0;
        static int k = 0;
        static void Main(string[] args)
        {
            int childs;
            int candies;
            int fatchild;
            int fatchildAt;
            string input;
            int[] kidsline;
                fatchild = 0;
                fatchildAt = 0;
                input = Console.ReadLine();
                childs = Convert.ToInt32(input.Split(' ')[0]);
                candies = Convert.ToInt32(input.Split(' ')[1]);
                kidsline = new int[childs];
                input = Console.ReadLine();
                if(kidsline[0] > candies)
                fatchild = kidsline[0];
                else
                fatchild = 0;
                while (isInt(kidsline) == false)
                {
                    for (int a = 0; a < childs; a++)
                    {
                        if (k == 0)
                        {
                            kidsline[a] = Convert.ToInt32(input.Split(' ')[a]);
                            if (!(kidsline[a] >= 1 && kidsline[a] <= 100))
                                continue;
                        }
                        if ((kidsline[a] >= fatchild && kidsline[a] > candies )|| (zeroo == kidsline.Length && kidsline[a] > 0 && k!=0))
                        {
                            fatchild = kidsline[a];
                            fatchildAt = a + 1;
                        }
                        kidsline[a] -= candies;
                    }
                    k++;
                    zeroo=0;
                }
                if (fatchildAt == 0)
                    fatchildAt = kidsline.Length;
                Console.WriteLine(fatchildAt);
        }
        public static bool isInt(int[] kidsline)
        {
            bool zeros = false;
            int zero = 0;
            foreach (var item in kidsline)
            {
                if (item <= 0)
                {
                    zero++;
                    zeroo++;
                }
            }
            if (zero == kidsline.Length && k !=0)
                zeros = true;
            return zeros;
        }
    }
}

using System;

namespace ConsoleApplication10
{
    class Program
    {
        static void Main(string[] args)
        {
            int childs;
            int candies;
            int fatchild;
            int fatchildAt;
            string input;
            int[] kidsline;
                fatchild = 0;
                fatchildAt = 0;
                input = Console.ReadLine();
                childs = Convert.ToInt32(input.Split(' ')[0]);
                candies = Convert.ToInt32(input.Split(' ')[1]);
                kidsline = new int[childs];
                input = Console.ReadLine();
                if(kidsline[0] > candies)
                fatchild = kidsline[0];
                else
                fatchild = 0;
                for (int a = 0; a < childs; a++)
                {
                    kidsline[a] = Convert.ToInt32(input.Split(' ')[a]);
                    if(!(kidsline[a] >= 1 && kidsline[a] <= 100))
                    continue;
                    if (kidsline[a] >= fatchild && kidsline[a] > candies)
                    {
                        fatchild = kidsline[a];
                        fatchildAt = a + 1;
                    }
                }
                if (fatchildAt == 0)
                    fatchildAt = kidsline.Length;
                Console.WriteLine(fatchildAt);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CF
{
    class Program
    {
        static void Main(string[] args)
        {

            String[] input = Console.ReadLine().Split(' ');
            long n = Int64.Parse(input[0]);
            long m = Int64.Parse(input[1]);
            input = Console.ReadLine().Split(' ');

            List<long> longList = new List<long>();
            long max = 0;
            long temp = 0;
            for (int i = 0; i < n; i++)
            {
                temp = Int64.Parse(input[i]);
                longList.Add(temp);
                if (temp > max) max = temp;
            }

            int j = longList.Count;
            while (longList.ElementAt(j-1) < max / m * m) j--;

            Console.WriteLine(j);

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CF
{
    class Program
    {
        static void Main(string[] args)
        {

            String[] input = Console.ReadLine().Split(' ');
            long n = Int64.Parse(input[0]);
            long m = Int64.Parse(input[1]);
            input = Console.ReadLine().Split(' ');

            List<long> longList = new List<long>();
            long max = 0;
            long temp = 0;
            for (int i = 0; i < n; i++)
            {
                temp = Int64.Parse(input[i]);
                longList.Add(temp);
                if (temp > max) max = temp;
            }

            int j = longList.Count;
            while (longList.ElementAt(j-1) < max / m * m) j--;

            Console.WriteLine(j+1);

        }
    }
}

using System;
using System.Linq;

namespace _450A
{
    class Program
    {
        static void Main()
        {
            var s = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var n = s[0]; var m = s[1];
            int max = 0, maxIndex = 0;
            var queue = Console.ReadLine().Split().Select(int.Parse).ToArray();
            for (int i=0;i<n;i++)
            {
                if (queue[i] >= max) { max = queue[i]; maxIndex = i; }
            }
            Console.WriteLine(maxIndex+1);
        }
    }
}

using System;
using System.Linq;

namespace _450A
{
    class Program
    {
        static void Main()
        {
            var s = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var n = s[0]; var m = s[1];
            int max = 0, maxIndex = 0;
            var queue = Console.ReadLine().Split().Select(int.Parse).ToArray();
            for (int i=0;i<n;i++)
            {
                if (queue[i] > max) { max = queue[i]; maxIndex = i; }
            }
            Console.WriteLine(maxIndex+1);
        }
    }
}