#include <bits/stdc++.h>
using namespace std;
long long int arr[100000];
long long int n, k;
int partition(long long int start, long long int end) {
  long long int pivot = arr[end] % 10;
  long long int pidx = start;
  for (long long int i = start; i < end; i++) {
    if (arr[i] % 10 >= pivot) {
      long long int temp = arr[i];
      arr[i] = arr[pidx];
      arr[pidx] = temp;
      pidx++;
    }
  }
  long long int temp = arr[end];
  arr[end] = arr[pidx];
  arr[pidx] = temp;
  return pidx;
}
void quicksort(long long int start, long long int end) {
  long long int pidx;
  if (start < end) {
    pidx = partition(start, end);
    quicksort(start, pidx - 1);
    quicksort(pidx + 1, end);
  }
}
bool compare(int a, int b) { return a % 10 < b % 10; }
int main() {
  cin >> n >> k;
  for (long long int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + n, compare);
  reverse(arr, arr + n);
  int flag = 0;
  for (long long int i = 0; i < n; i++) {
    if (arr[i] % 10 == 0) break;
    if (k < 10 - (arr[i] % 10)) {
      break;
    } else {
      k -= 10 - (arr[i] % 10);
      arr[i] = arr[i] + 10 - (arr[i] % 10);
    }
  }
  if (flag == 0) {
    for (long long int i = 0; i < n; i++) {
      if (k + arr[i] >= 100) {
        k = k - (100 - arr[i]);
        arr[i] = 100;
      } else if (k >= 10) {
        long long int t = (arr[i] + k) % 10;
        arr[i] = ((arr[i] + k) / 10) * 10;
        k = t;
      } else
        break;
    }
  }
  long long int sum = 0;
  for (long long int i = 0; i < n; i++) {
    sum += arr[i] / 10;
  }
  cout << sum;
  return 0;
}
