#include <bits/stdc++.h>
using namespace std;
long long n, k, i, j, l, nr2, nr5, nr, aux, d[210][3][12610], sol;
unsigned long long a;
int main() {
  cin >> n >> k;
  for (i = 0; i <= k; i++)
    for (j = 0; j <= 12600; j++) d[i][0][j] = d[i][1][j] = -1;
  d[0][1][0] = 0;
  for (i = 1; i <= n; i++) {
    cin >> a;
    nr2 = 0;
    nr5 = 0;
    while (a % 2 == 0) {
      nr2++;
      a /= 2;
    }
    while (a % 5 == 0) {
      nr5++;
      a /= 5;
    }
    aux = nr2 - nr5;
    nr = min(nr2, nr5);
    if (aux > 0) {
      for (l = k; l >= 1; l--) {
        for (j = 0; j <= 12600; j++) {
          if (j < aux) {
            if (d[l - 1][0][aux - j] != -1)
              d[l][1][j] = max(d[l][1][j], d[l - 1][0][aux - j] + nr + aux - j);
          } else if (d[l - 1][1][j - aux] != -1)
            d[l][1][j] = max(d[l][1][j], d[l - 1][1][j - aux] + nr);
        }
        for (j = 1; j <= 12600 - aux; j++)
          if (d[l - 1][0][j + aux] != -1)
            d[l][0][j] = max(d[l][0][j], d[l - 1][0][j + aux] + nr + aux);
      }
    } else {
      aux = -aux;
      for (l = k; l >= 1; l--) {
        for (j = 1; j <= 12600; j++) {
          if (j <= aux) {
            if (d[l - 1][1][aux - j] != -1)
              d[l][0][j] = max(d[l][0][j], d[l - 1][1][aux - j] + nr + aux - j);
          } else if (d[l - 1][0][j - aux] != -1)
            d[l][0][j] = max(d[l][0][j], d[l - 1][0][j - aux] + nr);
        }
        if (d[l - 1][1][aux] != -1)
          d[l][1][0] = max(d[l][1][0], d[l - 1][1][aux] + nr + aux);
        for (j = 1; j <= 12600 - aux; j++)
          if (d[l - 1][1][j + aux] != -1)
            d[l][1][j] = max(d[l][1][j], d[l - 1][1][j + aux] + nr + aux);
      }
    }
  }
  for (j = 0; j <= 12600; j++)
    sol = max(sol, d[k][0][j]), sol = max(sol, d[k][1][j]);
  cout << sol;
  return 0;
}
