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

namespace AtTest.ABC_105
{
    class D
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int n = int.Parse(input[0]);
            int m = int.Parse(input[1]);
            input = Console.ReadLine().Split(' ');
            var array = new long[n];
            var sums = new long[n];
            for (int i = 0; i < n; i++)
            {
                array[i] = long.Parse(input[i]);
                if (i == 0)
                {
                    sums[i] = array[i];
                }
                else
                {
                    sums[i] = sums[i - 1] + array[i];
                }
            }

            long cnt = 0;
            for(int i = 0; i < n; i++)//左端
            {
                for(int j = i; j < n; j++)//右端
                {
                    long val = i == 0 ? sums[j] : sums[j] - sums[i-1];
                    if (val % m == 0)
                    {
                        //Console.WriteLine(i.ToString() + " " + j.ToString());
                        cnt++;
                    }
                }
            }
            Console.WriteLine(cnt);
        }
    }
}
