#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, x;
  cin >> n >> k;
  vector<int> v, s;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    v.push_back(x);
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    ans += v[i] / 10;
  }
  for (int i = 0; i < n; i++) {
    if (v[i] == 100)
      continue;
    else {
      int D = v[i] % 10;
      s.push_back(10 - D);
    }
  }
  sort(s.begin(), s.end());
  int val = 0;
  int state = 1;
  for (int i = 0; i < s.size(); i++) {
    if (k >= s[i]) {
      val++;
      k -= s[i];
    } else {
      state = 0;
      break;
    }
  }
  cout << min(n * 10, val + ans + k / 10) << endl;
  return 0;
}
