input: from typing import List, Tuple
  import numpy as np
  
  def kmeans(k: int, data: np.ndarray) -> Tuple[np.ndarray, np.ndarray]:
      """
      Perform k-means clustering on data.
      
      >>> data = np.array([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0], [7.0, 8.0]])
      >>> kmeans(2, data)
      (array([1, 1, 0, 0]), array([[6., 7.5], [2., 3.]]))
      """
output:     n_samples, n_features = data.shape
      centroids = data[np.random.choice(n_samples, k, replace=False)]
      labels = np.zeros(n_samples)
      
      while True:
          distances = np.linalg.norm(data[:, np.newaxis] - centroids, axis=2)
          new_labels = np.argmin(distances, axis=1)
          
          if np.array_equal(labels, new_labels):
              break
          
          labels = new_labels
          for i in range(k):
              centroids[i] = data[labels == i].mean(axis=0)
      
      return labels, centroids