#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > v;
int main() {
  int n, k, num;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> num;
    v.push_back(pair<int, int>(10 - num % 10, num));
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < n; i++) {
    if (v[i].first == 10) break;
    if (k < v[i].first) break;
    k -= v[i].first;
    v[i].second += v[i].first;
  }
  for (int i = 0; i < n; i++) {
    if (v[i].second == 100) continue;
    if (k <= 100 - v[i].second) {
      v[i].second += k;
      break;
    } else {
      k -= (100 - v[i].second);
      v[i].second = 100;
    }
  }
  int rpta = 0;
  for (int i = 0; i < n; i++) rpta += (v[i].second) / 10;
  cout << rpta << endl;
  return 0;
}
