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

namespace Atcoder
{
    class Program
    {
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        private static void print(object obj) { Console.WriteLine(obj); }

        static void Main(string[] args)
        {
            var aa = ReadInts();
            long n = aa[0];
            long m = aa[1];

            var a = ReadLongs();
            long count = 0;

            for(long i = 0; i<= n-1;i++)
            {
                for(long j = i; j <= n-1;j++)
                {
                    if (ArraySum(a, i, j) % m == 0)
                        count ++;
                }

            }
            print(count);

        }

        static long ArraySum(long[] a ,long start, long last)
        {
            long result = 0;
            for(long i = start;i<= last; i++)
            {
                result += a[i];
            }
            return result;
        }

    }
}