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]);

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

            var a = new int[n];

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

            int count = 0;
            long tmp = 0;

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

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

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

            Console.WriteLine(count);
        }
    }
}