#include <bits/stdc++.h>
using namespace std;
int a[100005];
long long int n, k, sum = 0;
vector<pair<int, int> > v;
int main() {
  int i, j, t;
  cin >> n >> k;
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < n; i++) {
    j = 1;
    while (j * 10 < a[i]) j++;
    int diff = j * 10 - a[i];
    if (a[i] != 100)
      v.push_back(make_pair(diff, a[i]));
    else
      v.push_back(make_pair(0, 100));
  }
  sort(v.begin(), v.end());
  for (i = 0; i < n; i++) {
    if (k - v[i].first > 0) {
      v[i].second += v[i].first;
      k -= v[i].first;
    } else {
      v[i].second += k;
      k = 0;
    }
    sum += (v[i].second / 10);
  }
  if (k != 0) {
    sum = 0;
    for (i = 0; i < n; i++) {
      while (v[i].second != 100 && k >= 10) {
        v[i].second += 10;
        k -= 10;
      }
      sum += (v[i].second / 10);
    }
  }
  cout << sum;
  return 0;
}
