#include <bits/stdc++.h>
using namespace std;
bool compare(pair<int, int> a, pair<int, int> b) { return a.second < b.second; }
int main() {
  int n, k;
  cin >> n >> k;
  pair<int, int> power[n];
  for (int i = 0; i < n; ++i) {
    pair<int, int> a;
    int p;
    cin >> p;
    a.first = p;
    if (p % 10 == 0)
      a.second = 0;
    else
      a.second = 10 - p % 10;
    power[i] = a;
  }
  sort(power, power + n, compare);
  for (int i = 0; i < n; ++i) {
    if (power[i].first != 100) {
      k = k - power[i].second;
      if (k < 0) break;
      power[i].first = power[i].first + power[i].second;
    }
  }
  if (k > 0) {
    for (int i = 0; i < n; ++i) {
      while (power[i].first < 100 && k >= 10) {
        k = k - 10;
        power[i].first += 10;
      }
      if (k < 10) break;
    }
  }
  int res = 0;
  for (int i = 0; i < n; ++i) {
    res += power[i].first / 10;
  }
  cout << res << endl;
}
