#include <bits/stdc++.h>
using namespace std;
const int maxn = 205;
int dp[2][maxn][maxn * 30];
class node {
 public:
  int n5, n2;
};
node nodes[maxn];
int main() {
  int n, k;
  memset(nodes, 0, sizeof nodes);
  scanf("%d %d", &n, &k);
  int sum5 = 0;
  for (int i = 0; i < n; i++) {
    long long cnt1;
    scanf("%lld", &cnt1);
    while (cnt1 % 5 == 0) cnt1 /= 5, nodes[i].n5++;
    while (cnt1 % 2 == 0) cnt1 /= 2, nodes[i].n2++;
    sum5 += nodes[i].n5;
  }
  memset(dp, -1, sizeof dp);
  int now = 1, per = 0, cur = 1;
  for (int i = 0; i <= n; i++) dp[now][i][0] = dp[per][i][0] = 0;
  for (int i = 0; i < n; i++) {
    now = cur;
    per = cur ^ 1;
    cur ^= 1;
    for (int j = 1; j <= min(i + 1, k); j++) {
      for (int ss = 0; ss <= sum5; ss++) dp[now][j][ss] = dp[per][j][ss];
      for (int s = nodes[i].n5; s <= sum5; s++) {
        if (dp[per][j - 1][s - nodes[i].n5] >= 0) {
          dp[now][j][s] =
              max(dp[now][j][s], dp[per][j - 1][s - nodes[i].n5] + nodes[i].n2);
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i <= sum5; i++) ans = max(ans, min(dp[now][k][i], i));
  cout << ans << endl;
}
