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

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

            var a = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();


            int count = 0;
            long tmp = 0;

            for(int l = 0; l < n; l++)
            {
                tmp = 0;

                for(int r = l; r < n; r++)
                {
                        tmp += a[r];

                    if (tmp % m == 0)
                        count++;
                }
            }

            Console.WriteLine(count);
        }
    }
}