#include <bits/stdc++.h>
using namespace std;
bool fun(int x, int y) { return x > y; }
vector<long long> v, d;
int main() {
  long long s = 0, n, m, t, k = 0;
  vector<long long> v;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> t;
    s += t / 10;
    k += 10;
    v.push_back(t % 10);
  }
  sort(v.begin(), v.end(), fun);
  for (int i = 0; i < n; i++) {
    if (m < 10 - v[i])
      break;
    else {
      s++;
      m = m - 10 + v[i];
    }
  }
  s = s + m / 10;
  cout << min(k, s) << endl;
  return 0;
}
