using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace D
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var nm = Console.ReadLine().Trim().Split(' ').Select(long.Parse).ToArray();
            var ai = Console.ReadLine().Trim().Split(' ').Select(long.Parse).ToArray();
            var m = nm[1];
            var answer = 0L;
            for (var i = 0; i < ai.Length; i++)
            {
                var tmp = 0L;
                for (var j = i; j < ai.Length; j++)
                {
                    tmp += ai[j];
                    if (tmp % m == 0) answer++;
                }
            }
            Console.WriteLine(answer);
        }
    }
}
