#include <bits/stdc++.h>
using namespace std;
bool compare(int &a, int &b) { return (a % 10) > (b % 10); }
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> arr(n, 0);
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sort(arr.begin(), arr.end(), compare);
  for (int i = 0; i < n; i++) {
    int curr = 10 - (arr[i] % 10);
    if (curr <= k) {
      k -= curr;
      arr[i] += curr;
    }
  }
  int total = 0;
  for (int i = 0; i < n; i++) {
    total += (arr[i] / 10);
  }
  cout << min(10 * n, total + k / 10) << endl;
}
