#include <bits/stdc++.h>
using namespace std;
bool comp(int u, int v) { return (v % 10) < (u % 10); }
const int N = 1e5 + 10;
int n, k, r;
int a[N];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < (int)n; i++) {
    scanf("%d", &a[i]);
    r += (a[i] / 10);
  }
  sort(a, a + n, comp);
  bool revient = true;
  int s = 0;
  for (int i = 0; i < (int)n; i++) {
    if (a[i] == 100) continue;
    int u = 10 - (a[i] % 10);
    if (u <= k) {
      a[i] += u;
      k -= u;
      r++;
      s += (100 - a[i]) / 10;
    } else {
      revient = false;
      break;
    }
  }
  if (revient) r += min(s, k / 10);
  printf("%d", r);
  return 0;
}
