    using System;
    class Program
    {
        static void Main(string[] args)
        {

            // 入力
            String[] line1 = Console.ReadLine().Split(' ');
            int N = int.Parse(line1[0]);
            int M = int.Parse(line1[1]);
            String[] line2 = Console.ReadLine().Split(' ');
            int Anum = line2.Length;
            long[] A = new long[Anum];
            for (int i = 0; i < Anum; i++)
            {
                A[i] = int.Parse(line2[i]);
            }

            long arieru = 0;
            for (int i = 1; i < N + 1; i++)
            {
                for (int ii = i; ii < N + 1; ii++)
                {
                    long goukei = 0;
                    for (int iii = i; iii < ii + 1; iii++)
                    {
                        goukei += A[iii - 1];
                    }
                    if (goukei % M == 0)
                    {
                        arieru++;
                    }
                }
            }


            //出力
            //String result = "";
            Console.WriteLine(arieru);






            //System.Threading.Thread.Sleep(5000);

        }
    }