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

namespace Test
{
  public class Program
  {
    public static void Main()
    {
      var inputs = Console.ReadLine().Split(' ');
      var length = long.Parse(inputs[0]);
      var childrenCount = long.Parse(inputs[1]);
      var inputAs = Console.ReadLine().Split(' ').Select(input => long.Parse(input)).ToArray();
      var count = 0L;
      
      for (var i = 1L; i <= length; i++)
      {
        for (var j = 0L; j + i <= length; j++)
        {
          var index = j;
          var sum = 0L;
          for (var k = 0L; k < i; k++)
          {
            sum += inputAs[index + k];
          }
          if (sum % childrenCount == 0)
          {
            count++;
          }
        }
      }
      Console.WriteLine(count);
    }
  }
}
