#include <bits/stdc++.h>
using namespace std;
bool sortbysec(pair<long long, long long> a, pair<long long, long long> b) {
  if (a.first != b.first)
    return a.first < b.first;
  else
    return a.second > b.second;
}
long long sod(long long a) {
  long long s = 0;
  while (a > 0) {
    s += a % 10;
    a /= 10;
  }
  return s;
}
int main() {
  long long n, k, i, h, l, m, sum = 0;
  cin >> n >> k;
  long long a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<long long> ans;
  vector<pair<long long, long long> > v;
  for (i = 0; i < n; i++) {
    if (a[i] != 100) {
      h = ((a[i] / 10) + 1) * 10 - a[i];
      v.push_back(make_pair(h, a[i]));
    } else {
      v.push_back(make_pair(0, 100));
    }
  }
  sort(v.begin(), v.end(), sortbysec);
  for (i = 0; i < v.size(); i++) {
    h = v[i].first;
    if (k - h >= 0) {
      if (v[i].second + h <= 100) {
        v[i].second += h;
        ans.push_back(v[i].second);
        k -= h;
      } else {
        l = 100 - v[i].second;
        k -= l;
        v[i].second += l;
        ans.push_back(v[i].second);
      }
    } else {
      ans.push_back(v[i].second);
    }
  }
  sort(ans.begin(), ans.end());
  if (k > 0) {
    for (i = ans.size() - 1; i >= 0; i--) {
      if (k > 0) {
        h = 100 - ans[i];
        if (k >= h) {
          ans[i] += h;
          k -= h;
        } else {
          ans[i] += k;
          k = 0;
        }
        if (k == 0) {
          break;
        }
      } else {
        break;
      }
    }
  }
  for (i = 0; i < ans.size(); i++) {
    sum += ans[i] / 10;
  }
  cout << sum << "\n";
}
