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

namespace ABC
{
    class Program
    {
        static void Main(string[] args)
        {
            var split = Console.ReadLine().Split(' ');
            int N = int.Parse(split[0]);
            int M = int.Parse(split[1]);
            int[] A = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            long output = 0;
            for (int i = 0; i < N;i++)
            {
                long sum = 0;
                for(int j = i;j<N;j++)
                {
                    sum += A[j];
                    if (sum % M == 0) output++;
                }
            }
            Console.WriteLine(output);
        }
    }
}
