#include <bits/stdc++.h>
using namespace std;
const int maxn = 210;
int f2[2][maxn][12100], f5[2][maxn][12100];
int main() {
  int n, k, i, j, p, t2, t5, mm, t, nx;
  long long x;
  while (cin >> n >> k) {
    for (i = 0; i <= 1; i++)
      for (j = 0; j <= k; j++)
        for (p = 0; p <= 12000; p++) f2[i][j][p] = f5[i][j][p] = -1;
    f2[0][0][0] = f5[0][0][0] = 0;
    i = 1;
    mm = nx = 0;
    for (t = 0; t < n; t++) {
      i ^= 1;
      nx = 0;
      cin >> x;
      t2 = t5 = 0;
      while (x % 2 == 0) {
        x /= 2;
        t2++;
      }
      while (x % 5 == 0) {
        x /= 5;
        t5++;
      }
      int sup = min(k, t);
      for (j = 0; j <= sup; j++) {
        for (p = 0; p <= mm; p++) {
          if (f2[i][j][p] != -1) {
            if (p + t2 > t5) {
              f2[i ^ 1][j + 1][p + t2 - t5] =
                  max(f2[i ^ 1][j + 1][p + t2 - t5], f2[i][j][p] + t5);
              nx = max(nx, p + t2 - t5);
            } else {
              if (p + t2 < t5) {
                f5[i ^ 1][j + 1][t5 - p - t2] =
                    max(f5[i ^ 1][j + 1][t5 - p - t2], f2[i][j][p] + p + t2);
                nx = max(nx, t5 - p - t2);
              } else {
                f2[i ^ 1][j + 1][0] =
                    max(f2[i ^ 1][j + 1][0], f2[i][j][p] + t5);
                f5[i ^ 1][j + 1][0] =
                    max(f5[i ^ 1][j + 1][0], f2[i][j][p] + t5);
              }
            }
            f2[i ^ 1][j][p] = max(f2[i ^ 1][j][p], f2[i][j][p]);
            nx = max(nx, p);
            f2[i][j][p] = -1;
          }
          if (f5[i][j][p] != -1) {
            if (p + t5 > t2) {
              f5[i ^ 1][j + 1][p + t5 - t2] =
                  max(f5[i ^ 1][j + 1][p + t5 - t2], f5[i][j][p] + t2);
              nx = max(nx, p + t5 - t2);
            } else {
              if (p + t5 < t2) {
                f2[i ^ 1][j + 1][t2 - p - t5] =
                    max(f2[i ^ 1][j + 1][t2 - p - t5], f5[i][j][p] + p + t5);
                nx = max(nx, t2 - p - t5);
              } else {
                f2[i ^ 1][j + 1][0] =
                    max(f2[i ^ 1][j + 1][0], f5[i][j][p] + t2);
                f5[i ^ 1][j + 1][0] =
                    max(f5[i ^ 1][j + 1][0], f5[i][j][p] + t2);
              }
            }
            f5[i ^ 1][j][p] = max(f5[i ^ 1][j][p], f5[i][j][p]);
            nx = max(nx, p);
            f5[i][j][p] = -1;
          }
        }
      }
      mm = nx;
    }
    int ans = 0;
    if (n % 2 == 0)
      n = 0;
    else
      n = 1;
    for (i = 0; i <= mm; i++) {
      ans = max(ans, f2[n][k][i]);
      ans = max(ans, f5[n][k][i]);
    }
    cout << ans << endl;
  }
  return 0;
}
