#include <bits/stdc++.h>
using namespace std;
const int maxn = 5505;
int n, k, pow2[205], pow5[205], dp[2][maxn][205];
long long a[205];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = (0); i < (n); i++) scanf("%lld", &a[i]);
  memset(pow2, 0, sizeof(pow2));
  memset(pow5, 0, sizeof(pow5));
  for (int i = (0); i < (n); i++) {
    while (a[i] % 2 == 0) {
      pow2[i]++;
      a[i] /= 2;
    }
    while (a[i] % 5 == 0) {
      pow5[i]++;
      a[i] /= 5;
    }
  }
  memset(dp, -1, sizeof(dp));
  dp[0][0][0] = dp[1][0][0] = 0;
  for (int i = (1); i < (n + 1); i++) {
    for (int j = (1); j < (min(k, i) + 1); j++) {
      for (int l = (0); l < (maxn); l++) {
        if (pow5[i - 1] > l || dp[(i - 1) % 2][l - pow5[i - 1]][j - 1] == -1)
          dp[i % 2][l][j] = dp[(i - 1) % 2][l][j];
        else
          dp[i % 2][l][j] =
              max(dp[(i - 1) % 2][l][j],
                  dp[(i - 1) % 2][l - pow5[i - 1]][j - 1] + pow2[i - 1]);
      }
    }
  }
  int ans = 0;
  for (int i = (1); i < (maxn); i++) {
    ans = max(ans, min(i, dp[n % 2][i][k]));
  }
  cout << ans;
  return 0;
}
