#include <bits/stdc++.h>
using namespace std;
int n, i, j, a, sum, answ, k;
pair<int, int> p[100005];
int main() {
  scanf("%d%d", &n, &k);
  for (i = 1; i <= n; i++) {
    scanf("%d", &a);
    p[i] = make_pair((10 - a % 10) % 10, a);
  }
  sort(p + 1, p + n + 1);
  for (i = 1; i <= n; i++) {
    if (k < p[i].first) {
      answ += p[i].second / 10;
      continue;
    }
    k -= p[i].first;
    answ += (p[i].second + p[i].first) / 10;
  }
  answ += k / 10;
  cout << min(n * 10, answ) << endl;
  return 0;
}
