#include <bits/stdc++.h>
using namespace std;
const int size = 1e5 + 10;
int afx[size];
int dis[size];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  int total = 0;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", afx + i);
    dis[i] = 10 - afx[i] % 10;
    total += dis[i];
    ans += afx[i] / 10;
  }
  if (k <= total) {
    sort(dis, dis + n);
    int i = 0;
    while (k && i < n) {
      k -= dis[i];
      if (k < 0) break;
      ans++;
      i++;
    }
    printf("%d\n", min(10 * n, ans));
    return 0;
  }
  k -= total;
  ans += n;
  ans += k / 10;
  printf("%d\n", min(10 * n, ans));
  return 0;
}
