#include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;
int main() {
  long long n, k, i;
  scanf("%lld", &n);
  scanf("%lld", &k);
  vector<long long> a;
  for (i = 0; i < n; i++) {
    long long num;
    scanf("%lld", &num);
    a.push_back(num);
  }
  vector<long long> req(n, 0);
  long long ans = 0;
  long long fill = 0;
  for (i = 0; i < n; i++) {
    long long po = a[i];
    fill += a[i];
    ans += (po / 10);
    req[i] = (10 - (po % 10)) % 10;
  }
  sort(req.begin(), req.end());
  long long ptr = 0;
  while (k && ptr < n) {
    if (req[ptr] == 0) {
      ptr++;
      continue;
    }
    if (k >= req[ptr]) {
      k -= req[ptr];
      fill += req[ptr];
      ptr++;
      ans++;
    } else {
      break;
    }
  }
  long long maxs = 100 * n;
  long long lef = k / 10;
  cout << min(10 * n, ans + lef) << endl;
  return 0;
}
