#include <bits/stdc++.h>
using namespace std;
static const int MAX = 27 * 200;
long long a[222];
int f[2][222][11111];
int V(int a) { return min(max(0, a + MAX), MAX * 2); }
int get(long long a, int b) {
  int cnt = 0;
  while (a % b == 0) {
    ++cnt;
    a /= b;
  }
  return cnt;
}
void upd(int& a, int b) {
  if (a == -1) {
    a = b;
  } else {
    a = max(a, b);
  }
}
int sign(int a) { return a > 0 ? 1 : (a < 0 ? -1 : 0); }
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int x = 0, y = 1;
  memset(f[x], 0xff, sizeof(f[x]));
  f[x][0][V(0)] = 0;
  for (int i = 0; i < n; ++i, swap(x, y)) {
    int cnt2 = get(a[i], 2);
    int cnt5 = get(a[i], 5);
    memset(f[y], 0xff, sizeof(f[y]));
    for (int used = 0; used <= k; ++used) {
      for (int two_five = -MAX; two_five <= MAX; ++two_five) {
        if (f[x][used][V(two_five)] == -1) {
          continue;
        }
        upd(f[y][used][V(two_five)], f[x][used][V(two_five)]);
        if (used + 1 <= k) {
          int add = min(cnt2, cnt5);
          if (sign(two_five) * sign(cnt2 - cnt5) == -1) {
            add += min(abs(two_five), abs(cnt5 - cnt2));
          }
          int nxt_two_five = two_five + cnt2 - cnt5;
          upd(f[y][used + 1][V(nxt_two_five)], f[x][used][V(two_five)] + add);
        }
      }
    }
  }
  int ans = 0;
  for (int two_five = -MAX; two_five <= MAX; ++two_five) {
    if (f[x][k][V(two_five)] == -1) {
      continue;
    }
    ans = max(ans, f[x][k][V(two_five)]);
  }
  cout << ans << endl;
  return 0;
}
